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