def test_objects_unicity(self): # Main loop object is a Godot Object, calling `get_main_loop` from # python returns a different python wrapper on the same object each time. # However those wrappers should feel like they are the same object. ml = Engine.get_main_loop() ml2 = Engine.get_main_loop() self.assertEqual(ml, ml2) # Of course different objects should be different and equality # should not crash with bad given types self.assertNotEqual(ml, Object()) self.assertNotEqual(ml, None) self.assertNotEqual(ml, "") self.assertNotEqual(ml, 42)
def test_objects_unicity(self): # Main loop object is a Godot Object, calling `get_main_loop` from # python returns a different python wrapper on the same object each time. # However those wrappers should feel like they are the same object. ml = Engine.get_main_loop() ml2 = Engine.get_main_loop() assert ml == ml2 # Of course different objects should be different and equality # should not crash with bad given types obj = Object() assert ml != obj assert ml != None # noqa assert ml != "" assert ml != 42 # Don't forget to free the Godot Object obj.free()
def test_singletons(self): assert isinstance(Engine, _Engine) assert callable(Engine.get_main_loop) ml = Engine.get_main_loop() assert isinstance(ml, Object)
def test_singletons(self): self.assertEqual(type(Engine), _Engine) self.assertTrue(callable(Engine.get_main_loop)) ml = Engine.get_main_loop() self.assertTrue(isinstance(ml, Object))