Skip to content

Commit

Permalink
Add test for creating items with position.
Browse files Browse the repository at this point in the history
It seems the entity creation interface has a really surprising
nonuniformity here. There's likely a need to chase this further with
all objects, but for now this at least documents one problem.

TEST=TestEntity.test_create_with_position
  • Loading branch information
gavinp committed Dec 25, 2024
1 parent 8708b12 commit 8af22f7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def test_suggest_similar_name(self):
):
Container("wodenchest")

def test_create_with_position(self):
iron_chest = new_entity('iron-chest', tile_position=(3,3))
assert iron_chest.position.x == 3.5 and iron_chest.position.y == 3.5

active_provider_chest = new_entity('active-provider-chest', tile_position=(10,10))
assert active_provider_chest.position.x == 10.5 and active_provider_chest.position.y == 10.5

def test_set_position(self):
iron_chest = Container("iron-chest")
iron_chest.position = (1.23, 1.34)
Expand Down

0 comments on commit 8af22f7

Please sign in to comment.