Example #1
0
    def test_snapshot(self):
        '''Test a game state snapshot'''
        g = Game.Game(Me({'White'}), [Player("Foo", 17)])
        g2 = g.snapshot()
        t = Cards.Triple('White', 'Rope', 'Hall')

        g.me.ask(t)
        g.others[0].show(t)

        assert not g2.me.asked
        assert not g2.others[0].shown
Example #2
0
	def test_invalid_person(self):
		with pytest.raises(Cards.InvalidTriple):
			Cards.Triple('Invalid', 'Rope', 'Hall')
Example #3
0
	def test_all_cards(self):
		t = Cards.Triple('Green', 'Rope', 'Hall')
		assert t.all_cards == ['Green', 'Rope', 'Hall']
Example #4
0
	def test_repr(self):
		t = Cards.Triple('Green', 'Rope', 'Hall')
		assert repr(t) == "Triple('Green', 'Rope', 'Hall')"
Example #5
0
	def test_room(self):
		t = Cards.Triple('Green', 'Rope', 'Hall')
		assert t.room == 'Hall'
Example #6
0
	def test_weapon(self):
		t = Cards.Triple('Green', 'Rope', 'Hall')
		assert t.weapon == 'Rope'
Example #7
0
	def test_person(self):
		t = Cards.Triple('Green', 'Rope', 'Hall')
		assert t.person == 'Green'
Example #8
0
	def test_invalid_room(self):
		with pytest.raises(Cards.InvalidTriple):
			Cards.Triple('Green', 'Rope', 'Invalid')
Example #9
0
	def test_invalid_weapon(self):
		with pytest.raises(Cards.InvalidTriple):
			Cards.Triple('Green', 'Invalid', 'Hall')