def get_guess(self): p1 = Player(u"Test1", u"Mr. Green") p2 = Player(u"Test2", u"Col. Mustard") p1.set_objects([u"wrench", u"kitchen"]) guess_order = [p1, p2] gs = Guess(u"Prof. Plum", u"wrench", u"kitchen", guess_order) return gs
def test_set_illegal_object(self): pl = Player(u"Sven", u"Miss Scarlett") with pytest.raises(ValueError): pl.set_objects([u"library", u"Mrs. Peacock", u"TestUser"])
def test_set_has_object(self): pl = Player(u"Sven", u"Miss Scarlett") pl.set_objects([u"library", u"Mrs. Peacock"]) assert (pl.has_object(u"library") == True) assert (pl.has_object(u"Miss Scarlett") == False)
def test_get_objects(self): pl = Player(u"Sven", u"Mr. Green") pl.set_objects([u"library"]) assert (u"library" in pl.get_objects())
def test_set_objects(self): pl = Player(u"Sven", u"Miss Scarlett") pl.set_objects([u"library", u"Mrs. Peacock"]) assert (u"library" in pl._objects) assert (u"Mrs. Peacock" in pl._objects)
def test_get_names(self): pl = Player(u"Sven", u"Miss Scarlett") assert (pl.get_playername() == u"Sven") assert (pl.get_charactername() == u"Miss Scarlett")
def test_wrong_character(self): with pytest.raises(ValueError): pl = Player(u"Sven", u"Mis Scarlett")
def test_init(self): pl = Player(u"Sven", u"Miss Scarlett") assert (pl._player_name == u"Sven") assert (pl._character_name == u"Miss Scarlett")