def top8(self): user = User(self.user) if self.parser.target_user: user.add_to_top_eight(self.parser.target_user) return f"@{self.parser.target_user} is now in @{self.user}'s Top 8!" else: raise ValueError(f"We have no target user to add to Top 8 {self.args}")
def test_props_random(self, mock_find_random_user): uzi = User("uzi") uzi.update_street_cred(10) uzi.add_to_top_eight("future") uzi.add_to_top_eight("young.thug") uzi.add_to_top_eight("wheezy") result = EconomyRouter(uzi.name, "props", ["random", "2"]).route() assert result == "@uzi gave 1 Street Cred to @future @young.thug each" result = EconomyRouter(uzi.name, "props", ["random"]).route() assert result == "@uzi gave 1 Street Cred to @wheezy"
def test_top_eight(self): uzi = User("uzi") assert uzi.top_eight() == [] uzi.add_to_top_eight("playboi.carti") assert uzi.top_eight() == ["playboi.carti"] uzi.add_to_top_eight("playboi.carti") assert uzi.top_eight() == ["playboi.carti"] uzi.remove_from_top_eight("playboi.carti") assert uzi.top_eight() == [] uzi.remove_from_top_eight("playboi.carti") assert uzi.top_eight() == [] for x in range(0, 8): uzi.add_to_top_eight(f"user_{x}") with pytest.raises(ValueError) as err: uzi.add_to_top_eight("one_too_many") uzi.clear_top_eight() assert uzi.top_eight() == []