test_ratings.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from yandex_music import Ratings
  2. class TestRatings:
  3. week = 4949
  4. month = 6597
  5. day = 5512
  6. def test_expected_values(self, ratings):
  7. assert ratings.week == self.week
  8. assert ratings.month == self.month
  9. assert ratings.day == self.day
  10. def test_de_json_none(self, client):
  11. assert Ratings.de_json({}, client) is None
  12. def test_de_json_required(self, client):
  13. json_dict = {'week': self.week, 'month': self.month}
  14. ratings = Ratings.de_json(json_dict, client)
  15. assert ratings.week == self.week
  16. assert ratings.month == self.month
  17. def test_de_json_all(self, client):
  18. json_dict = {'week': self.week, 'month': self.month, 'day': self.day}
  19. ratings = Ratings.de_json(json_dict, client)
  20. assert ratings.week == self.week
  21. assert ratings.month == self.month
  22. assert ratings.day == self.day
  23. def test_equality(self):
  24. a = Ratings(self.week, self.month)
  25. b = Ratings(10, self.month)
  26. c = Ratings(self.week, self.month, self.day)
  27. assert a != b
  28. assert hash(a) != hash(b)
  29. assert a is not b
  30. assert a == c