1def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name):
2 class Mixin:
3
4 def __init__(self):
5 pass
6
7 def is_a_witch(self):
8 if hasattr(self, mass_attr_name) and getattr(self, mass_attr_name) == mass:
9 return "Burn her!"
10 elif hasattr(self, material_attr_name) and getattr(self, material_attr_name) == material:
11 return "Burn her!"
12 elif hasattr(self, float_method_name):
13 return "Burn her!"
14 else:
15 return "No, but it's a pity, cuz she looks like a witch!"
16
17 return Mixin
F
======================================================================
FAIL: test_realcase (test.TestWitchMixinFactory)
Real test for the Witch factory.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 50, in test_realcase
self.assertEqual(FloatFalse().is_a_witch(), self.RESULT_FALSE)
AssertionError: 'Burn her!' != "No, but it's a pity, cuz she looks like a witch!"
- Burn her!
+ No, but it's a pity, cuz she looks like a witch!
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (failures=1)