Module gamecontext
[hide private]
[frames] | no frames]

Module gamecontext

source code

This module implements the GameContext class

Classes [hide private]
  GameContext
A GameContext corresponds to a geographic location and is a collection of GameObjects, GameActors and state attributes.
  TestObject
A TestObject is a hidden object that will be found after a specified number of searches.
Functions [hide private]
 
member_tests()
exercise {add,remove}_member and get_party
source code
 
npc_tests()
exercise {add,remove}_npc and get_npcs
source code
 
get_tests()
exercise hierarchical gets
source code
 
search_tests()
exercise search for hidden objects
source code
 
main()
Run all unit-test cases and print out summary of results
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

member_tests()

source code 

exercise {add,remove}_member and get_party

  • new & empty
  • add one, add a second
  • delete the first, add a third
  • delete the third, delete the second

npc_tests()

source code 

exercise {add,remove}_npc and get_npcs

  • new & empty
  • add one, add a second
  • delete the first, add a third
  • delete the third, delete the second

get_tests()

source code 

exercise hierarchical gets

set distinct and overlapping properties at various levels of nested GameContexts, and see which values are returned from gets in different levels:

  • each level has a different value
  • different levels define different properties
  • a property in no level will return None

search_tests()

source code 

exercise search for hidden objects

  • create a context with one non-hidden and three hidden test objects
  • the test objects will be discovered after 1, 2, and 3 searches
  • do three searches and confirm the right objects found by each