Ejemplo n.º 1
0
 def test_noway(self):
     out, err = test_helpers.capture_io(game.noway, test_helpers.dummy)
     assert out == "There is nothing in that direction."
     assert err == ""
Ejemplo n.º 2
0
 def test_rules(self):
     out, err = test_helpers.capture_io(game.rules, test_helpers.dummy)
     assert ("This is a complex world but I am a simple guide."
             in out) == True
     assert err == ""
Ejemplo n.º 3
0
 def test_idk(self):
     out, err = test_helpers.capture_io(game.idk, test_helpers.dummy)
     assert out == "I don't know what that means..."
     assert err == ""
Ejemplo n.º 4
0
 def test_play(self):
     sys.stdin = io.StringIO("quit\n")
     out, err = test_helpers.capture_io(game.play)
     assert ("You are standing in a near pitch-black alley which"
             in out) == True
     assert err == ""
Ejemplo n.º 5
0
 def test_quit(self):
     out, err = test_helpers.capture_io(game.quit)
     assert out == "You may yet live to see another day."
     assert err == ""
Ejemplo n.º 6
0
 def test_start_options(self):
     for move, text in test_helpers.start_moves.items():
         sys.stdin = io.StringIO("{}\nquit\n".format(move))
         out, err = test_helpers.capture_io(game.start_options)
         assert (text in out) == True
         assert err == ""
Ejemplo n.º 7
0
 def test_west_alley(self):
     for move, text in test_helpers.west_alley_moves.items():
         sys.stdin = io.StringIO("{}\nquit\n".format(move))
         out, err = test_helpers.capture_io(game.west_alley)
         assert (text in out) == True
         assert err == ""