Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shearing should not change the types of the objects in a flock #1

Open
Ciemaar opened this issue Feb 14, 2018 · 0 comments
Open

Shearing should not change the types of the objects in a flock #1

Ciemaar opened this issue Feb 14, 2018 · 0 comments
Assignees

Comments

@Ciemaar
Copy link
Owner

Ciemaar commented Feb 14, 2018

def find_char(template, stats):
template['ExSeed'] = 0
passes_check = False
while not passes_check:
print('trying')
template.shear()
for sn, sv in stats.items():
stat = template['stats'][sn]
print(f'Checking {sn} {sv} vs {stat}')
if template['stats'][sn] < sv:
print('stepping')
template['ExSeed'] += 1
break
else:
passes_check = True
template['base_stats'] = template['base_stats'].shear()
return template
throws error:


AttributeError Traceback (most recent call last)
in ()
2 beastmaster['level'] = 5
3 beastmaster['bonuses']['racial']={'MA':ma_bonus,'PS':ps_bonus,'PE':pe_bonus}
----> 4 beastmaster = find_char(beastmaster,{'MA': 12, 'PS':10, 'PE':10})
5 beastmaster['Psionics'] = ['Animal Control']
6

in find_char(template, stats)
14 else:
15 passes_check = True
---> 16 template['base_stats'] = template['base_stats'].shear()
17 return template

AttributeError: 'collections.OrderedDict' object has no attribute 'shear'

but any dict added to a flock should have been converted to a flockDict.

Ciemaar added a commit that referenced this issue Feb 18, 2018
* Test cases based on report #1
* fixes for the same

*
@Ciemaar Ciemaar self-assigned this Feb 18, 2018
@Ciemaar Ciemaar mentioned this issue Feb 18, 2018
Ciemaar added a commit that referenced this issue Feb 18, 2018
* Mutable mappings are no longer longer cached

* Test cases based on report #1
* fixes for the same
* Added additional tests for similar possible bugs.

* Made FlockException a subtype of KeyError to allow it to be handled more naively
* Separate handling at key points
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant