1def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name):
2 class LogicMixin:
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 if hasattr(self, material_attr_name) and getattr(self, material_attr_name) == material:
7 return "Burn her!"
8 if hasattr(self, float_method_name) and callable(getattr(self, float_method_name, None)):
9 return "Burn her!"
10 return "No, but it's a pity, cuz she looks like a witch!"
11
12 return LogicMixin
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK