1def logic_mixin_factory(
2 mass, mass_attr_name, material, material_attr_name, float_method_name
3):
4 class Dummy:
5 def is_a_witch(self):
6 mass_value = getattr(self, mass_attr_name, None)
7 material_value = getattr(self, material_attr_name, None)
8 method_value = getattr(self, float_method_name, None)
9 return (
10 "Burn her!"
11 if (
12 mass_value == mass
13 or material_value == material
14 or callable(method_value)
15 )
16 else "No, but it's a pity, cuz she looks like a witch!"
17 )
18
19 return Dummy
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
10.11.2023 14:31