def test_handler_del_attr(self): class Foo: pass handle = Handler(override_type=Foo) handle._connection.foo = 11 handle.bar = 15 del (handle.foo) self.assertFalse(hasattr(handle._connection, 'foo')) del (handle._connection.bar) self.assertFalse(hasattr(handle, 'bar'))
def test_handler_attr(self): class Foo: pass handle = Handler(override_type=Foo) # Set on handle handle.bar = 15 # Debug verify on connection self.assertEqual(handle._connection.bar, 15) # Emulate something in connection changing itself handle._connection.foo = 11 # Verify on handler self.assertEqual(handle.foo, 11)