def test_dunder(self): """ Test the __magic__ methods on GDObject """ v = Vector2(1, 2) self.assertEqual(repr(v), "Vector2( 1, 2 )") v2 = Vector2(1, 2) self.assertEqual(v, v2) v2.x = 10 self.assertNotEqual(v, v2) self.assertNotEqual(v, (1, 2))
def test_vector2(self): """ Test for Vector2 """ v = Vector2(1, 2) self.assertEqual(v[0], 1) self.assertEqual(v[1], 2) self.assertEqual(v.x, 1) self.assertEqual(v.y, 2) self.assertEqual(str(v), "Vector2( 1, 2 )") v.x = 2 v.y = 3 self.assertEqual(v.x, 2) self.assertEqual(v.y, 3) v[0] = 3 v[1] = 4 self.assertEqual(v[0], 3) self.assertEqual(v[1], 4)
GDSectionHeader( "ext_resource", path="res://Sample.tscn", type="PackedScene", id=1 ) ), ), ), ( """[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 12.7855, 17.0634 ) other = null "with spaces" = 1 """, GDFile( GDSection( GDSectionHeader("sub_resource", type="RectangleShape2D", id=1), extents=Vector2(12.7855, 17.0634), other=None, **{"with spaces": 1} ) ), ), ( """[sub_resource type="Animation" id=2] tracks/0/keys = { "transitions": PoolRealArray( 1, 1 ), "update": 0, "values": [ Vector2( 0, 0 ), Vector2( 1, 0 ) ] }""", GDFile( GDSection( GDSectionHeader("sub_resource", type="Animation", id=2),