1def logic_mixin_factory(mass: int, mass_attr_name: str, material: str, material_attr_name: str, float_method_name: str):
2 class WitchDetector:
3 def is_a_witch(self):
4 if (mass == getattr(self, mass_attr_name, None) or
5 material == getattr(self, material_attr_name, None) or
6 callable(getattr(self, float_method_name, None))):
7 return "Burn her!"
8 else:
9 return "No, but it's a pity, cuz she looks like a witch!"
10 return WitchDetector
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
f | 1 | def logic_mixin_factory(mass: int, mass_attr_name: str, material: str, material_attr_name: str, float_method_name: str): | f | 1 | def logic_mixin_factory(mass: int, mass_attr_name: str, material: str, material_attr_name: str, float_method_name: str): |
2 | class WitchDetector: | 2 | class WitchDetector: | ||
3 | def is_a_witch(self): | 3 | def is_a_witch(self): | ||
t | 4 | if mass == getattr(self, mass_attr_name, None) or material == getattr(self, material_attr_name, None) or callable(getattr(self, float_method_name, None)): | t | 4 | if (mass == getattr(self, mass_attr_name, None) or |
5 | material == getattr(self, material_attr_name, None) or | ||||
6 | callable(getattr(self, float_method_name, None))): | ||||
5 | return "Burn her!" | 7 | return "Burn her!" | ||
6 | else: | 8 | else: | ||
7 | return "No, but it's a pity, cuz she looks like a witch!" | 9 | return "No, but it's a pity, cuz she looks like a witch!" | ||
8 | return WitchDetector | 10 | return WitchDetector |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|