Bug fix: Quirk ordering. (Don't give certain quirk types priority)
This commit is contained in:
parent
cfa7b16467
commit
cfa1d7cd1b
1 changed files with 6 additions and 10 deletions
16
dataobjs.py
16
dataobjs.py
|
@ -124,10 +124,6 @@ class pesterQuirks(object):
|
||||||
def apply(self, lexed, first=False, last=False):
|
def apply(self, lexed, first=False, last=False):
|
||||||
prefix = [q for q in self.quirklist if q.type=='prefix']
|
prefix = [q for q in self.quirklist if q.type=='prefix']
|
||||||
suffix = [q for q in self.quirklist if q.type=='suffix']
|
suffix = [q for q in self.quirklist if q.type=='suffix']
|
||||||
replace = [q for q in self.quirklist if
|
|
||||||
q.type=='replace' or q.type=='regexp']
|
|
||||||
randomrep = [q for q in self.quirklist if q.type=='random']
|
|
||||||
spelling = [q for q in self.quirklist if q.type=='spelling']
|
|
||||||
|
|
||||||
newlist = []
|
newlist = []
|
||||||
for (i, o) in enumerate(lexed):
|
for (i, o) in enumerate(lexed):
|
||||||
|
@ -141,12 +137,12 @@ class pesterQuirks(object):
|
||||||
continue
|
continue
|
||||||
lastStr = (i == len(lexed)-1)
|
lastStr = (i == len(lexed)-1)
|
||||||
string = o
|
string = o
|
||||||
for s in spelling:
|
for q in self.quirklist:
|
||||||
string = s.apply(string)
|
if q.type != 'prefix' and q.type != 'suffix':
|
||||||
for r in randomrep:
|
if q.type == 'regexp' or q.type == 'random':
|
||||||
string = r.apply(string, first=(i==0), last=lastStr)
|
string = q.apply(string, first=(i==0), last=lastStr)
|
||||||
for r in replace:
|
else:
|
||||||
string = r.apply(string, first=(i==0), last=lastStr)
|
string = q.apply(string)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
if len(prefix) >= 1:
|
if len(prefix) >= 1:
|
||||||
myprefix = random.choice(prefix)
|
myprefix = random.choice(prefix)
|
||||||
|
|
Loading…
Reference in a new issue