1def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name):
2 class Mixin:
3 def is_a_witch(self):
4 if hasattr(self, mass_attr_name) and getattr(self,mass_attr_name) == mass:
5 return "Burn her!"
6 elif hasattr(self, material_attr_name) and getattr(self, material_attr_name) == material:
7 return "Burn her!"
8 elif hasattr(self, float_method_name) and callable(getattr(self, float_method_name)):
9 return "Burn her!"
10 else:
11 return "No, but it's a pity, cuz she looks like a witch!"
12 return Mixin
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
f | 1 | def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name): | f | 1 | def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name): |
n | 2 | class Mixin(): | n | 2 | class Mixin: |
3 | def is_a_witch(self): | 3 | def is_a_witch(self): | ||
n | 4 | if hasattr(self, mass_attr_name) and self.__getattribute__(mass_attr_name) == mass: | n | 4 | if hasattr(self, mass_attr_name) and getattr(self,mass_attr_name) == mass: |
5 | return "Burn her!" | 5 | return "Burn her!" | ||
n | 6 | elif hasattr(self, material_attr_name) and self.__getattribute__(material_attr_name) == material: | n | 6 | elif hasattr(self, material_attr_name) and getattr(self, material_attr_name) == material: |
7 | return "Burn her!" | 7 | return "Burn her!" | ||
n | 8 | elif hasattr(self, float_method_name) and callable(self.__getattribute__(float_method_name)): | n | 8 | elif hasattr(self, float_method_name) and callable(getattr(self, float_method_name)): |
9 | return "Burn her!" | 9 | return "Burn her!" | ||
10 | else: | 10 | else: | ||
11 | return "No, but it's a pity, cuz she looks like a witch!" | 11 | return "No, but it's a pity, cuz she looks like a witch!" | ||
12 | return Mixin | 12 | return Mixin | ||
t | 13 | t | |||
14 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
f | 1 | def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name): | f | 1 | def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name): |
2 | class Mixin(): | 2 | class Mixin(): | ||
3 | def is_a_witch(self): | 3 | def is_a_witch(self): | ||
n | 4 | if hasattr(self,mass_attr_name) and self.__getattribute__(mass_attr_name) == mass: | n | 4 | if hasattr(self, mass_attr_name) and self.__getattribute__(mass_attr_name) == mass: |
5 | return "Burn her!" | 5 | return "Burn her!" | ||
n | 6 | elif hasattr(self,material_attr_name) and self.__getattribute__(material_attr_name) == material: | n | 6 | elif hasattr(self, material_attr_name) and self.__getattribute__(material_attr_name) == material: |
7 | return "Burn her!" | 7 | return "Burn her!" | ||
t | 8 | elif hasattr(self,float_method_name) and callable(self.__getattribute__(float_method_name)): | t | 8 | elif hasattr(self, float_method_name) and callable(self.__getattribute__(float_method_name)): |
9 | return "Burn her!" | 9 | return "Burn her!" | ||
10 | else: | 10 | else: | ||
11 | return "No, but it's a pity, cuz she looks like a witch!" | 11 | return "No, but it's a pity, cuz she looks like a witch!" | ||
12 | return Mixin | 12 | return Mixin | ||
13 | 13 | ||||
14 | 14 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|