Tests Package#
Submodules#
Test Avatar Class#
Test Avatar Inventory#
- class game.test_suite.tests.test_avatar_inventory.TestAvatarInventory(methodName='runTest')[source]#
Bases:
TestCaseTest Avatar Inventory Notes:
This class tests the different methods in the Avatar class related to the inventory system. This is its own file since the inventory system has a lot of functionality. Look extensively at the different cases that are tested to better understand how it works if there is still confusion.
- test_take()[source]#
- Take method test:
When this test is performed, it works properly, but because the Item class is used and is very generic, it may not seem to be the case. However, it does work in the end. The first item in the inventory has its quantity decrease to 2 after the take method is executed. Then, the helper method, clean_inventory, consolidates all similar Items with each other. This means that inventory[1] will add its quantity to inventory[0], making it have a quantity of 5; inventory[1] now has a quantity of 4 instead of 7. Then, inventory[2] will add its quantity to inventory[1], making it have a quantity of 7; inventory[2] now has a quantity of 7.
To recap: When the take method is used, it will work properly with more specific Item classes being created to consolidate the same Item object types together
When more subclasses of Item are created, more specific tests can be created if needed.
Test Example Class#
- class game.test_suite.tests.test_example.TestExample(methodName='runTest')[source]#
Bases:
TestCaseTest Example Notes:
This is a mock test class to model tests after. The setUp method MUST be in camel-case for every test file. Everything else can be in snake_case as normal.
- The command to run tests is:
python -m game.test_suite.runner
Test Gameboard Class#
- class game.test_suite.tests.test_game_board.TestGameBoard(methodName='runTest')[source]#
Bases:
TestCaseTest Gameboard Notes:
This class tests the different methods in the Gameboard class. This file is worthwhile to look at to understand the GamebBoard class better if there is still confusion on it.
This class tests the Gameboard specifically when the map is generated.
Test Gameboard (No Generation)#
Test Initialization Class#
Test Interact Controller Class#
Test Inventory Controller Class#
Test Item Class#
Test Master Controller Class#
Test Movement Controller Class#
- class game.test_suite.tests.test_movement_controller.TestMovementControllerIfWall(methodName='runTest')[source]#
Bases:
TestCaseTest Movement Controller if Wall Notes:
This class tests the Movement Controller specifically for when there are walls – or other impassable objects – near the Avatar.
Test Movement Controller with Occupiable Stations the Avatar can Occupy#
- class game.test_suite.tests.test_movement_controller_if_occupiable_station_is_occupiable.TestMovementControllerIfOccupiableStationIsOccupiable(methodName='runTest')[source]#
Bases:
TestCaseTest Movement Controller if Occupiable Stations are Occupiable Notes:
This class tests the different methods in the Movement Controller class and the Avatar moving onto Occupiable Stations so that the Avatar can occupy it.
Test Movement Controller with Occupiable Stations#
- class game.test_suite.tests.test_movement_controller_if_occupiable_stations.TestMovementControllerIfOccupiableStations(methodName='runTest')[source]#
Bases:
TestCaseTest Movement Controller with Occupiable Stations that are Occupied Notes:
This class tests the different methods in the Movement Controller and that the Avatar can’t move onto an Occupiable Station that is occupied by an unoccupiable object (e.g., a Wall or Station object).
Test Movement Controller with Stations the Avatar Can’t Occupy#
- class game.test_suite.tests.test_movement_controller_if_stations.TestMovementControllerIfStations(methodName='runTest')[source]#
Bases:
TestCaseTest Movement Controller with Stations Notes:
This class tests the different methods in the Movement Controller and that the Avatar can’t move onto a Station object (an example of an impassable object).