<s> import pytest <EOL> from modules . level import Level , highest_display_priority <EOL> from modules . monsters import Cockroach <EOL> from modules . item import Item <EOL> @ pytest . fixture <EOL> def level ( ) : <EOL> contents = [ ] <EOL> item = Item ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> item . place ( ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> roach = Cockroach ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> roach . place ( ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> contents . append ( item ) <EOL> contents . append ( roach ) <EOL> return Level ( contents , <NUM_LIT:4> ) <EOL> def test_level_accepts_a_list_of_contents_and_a_size ( level ) : <EOL> assert len ( level . contents ) == <NUM_LIT:2> <EOL> assert level . size == <NUM_LIT:4> <EOL> def test_contents_at_coords_finds_no_contents_at_empty_coords ( level ) : <EOL> assert len ( level . contents_at_coords ( ( <NUM_LIT:0> , <NUM_LIT:0> ) ) ) == <NUM_LIT:0> <EOL> def test_contents_at_coords_finds_contents_at_its_coords ( level ) : <EOL> results = level . contents_at_coords ( ( <NUM_LIT:2> , <NUM_LIT:3> ) ) <EOL> assert len ( results ) == <NUM_LIT:1> <EOL> assert type ( results [ <NUM_LIT:0> ] ) is Cockroach <EOL> def test_get_by_name_returns_content_with_name ( level ) : <EOL> result = level . get_by_name ( "<STR_LIT>" ) <EOL> assert result . name == "<STR_LIT>" <EOL> def test_get_by_name_returns_none_for_invalid_name ( level ) : <EOL> result = level . get_by_name ( "<STR_LIT>" ) <EOL> assert result == None <EOL> def test_get_location_by_name_returns_just_coords ( level ) : <EOL> result = level . get_location_by_name ( "<STR_LIT>" ) <EOL> assert result == ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> def test_can_get_highest_display_priority ( level ) : <EOL> items = [ ] <EOL> high = Item ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> high . display_priority = <NUM_LIT:100> <EOL> items . append ( high ) <EOL> med = Item ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> med . displau_priority = <NUM_LIT:10> <EOL> items . append ( med ) <EOL> low = Item ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> low . display_priority = <NUM_LIT:0> <EOL> items . append ( low ) <EOL> result = highest_display_priority ( items ) <EOL> assert result . display_priority == <NUM_LIT:100> <EOL> def test_can_return_contents_with_move_ai ( level ) : <EOL> creatures = level . get_move_ai ( ) <EOL> assert len ( creatures ) == <NUM_LIT:1> </s>
