def test_no_invert_just_inits(self): vi = inspector.ValueInspector() vi.invert_eq = False def value_test(*args, **kwargs): return 'hello, friends' ret = vi._make_value_test(value_test, 'asdf', foo='bar') self.assertEqual(ret, 'hello, friends')
def test_invert_returns_inverter(self): vi = inspector.ValueInspector() vi.invert_eq = True class vt(object): def __eq__(self, other): return True inverter = vi._make_value_test(vt) assert isinstance(inverter, vt) self.assertEqual(inverter.__eq__('whatever'), False)