1def logic_mixin_factory(mass, mass_attr_name, material, material_attr_name, float_method_name):
2 class WitchMixin:
3 def is_a_witch(self):
4 is_for_real = False
5
6 is_for_real |= hasattr(self, mass_attr_name) and self.__getattribute__(mass_attr_name) == mass
7 is_for_real |= hasattr(self, material_attr_name) and self.__getattribute__(material_attr_name) == material
8 is_for_real |= hasattr(self, float_method_name)
9
10 return "Burn her!" if is_for_real else "No, but it's a pity, cuz she looks like a witch!"
11
12 return WitchMixin
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)