1def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name):
2 class WitchTrial:
3 def is_a_witch(self):
4 is_witch = False
5 if mass_attr_name in dir(self):
6 is_witch = is_witch or (mass == getattr(self, mass_attr_name))
7 if material_attr_name in dir(self):
8 is_witch = is_witch or (material == getattr(self, material_attr_name))
9 if(is_witch or float_method_name in dir(self)):
10 return "Burn her!"
11 return "No, but it's a pity, cuz she looks like a witch!"
12 return WitchTrial
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.001s
FAILED (failures=1)