test_plus.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from yandex_music import Plus
  2. class TestPlus:
  3. has_plus = True
  4. is_tutorial_completed = True
  5. def test_expected_values(self, plus):
  6. assert plus.has_plus == self.has_plus
  7. assert plus.is_tutorial_completed == self.is_tutorial_completed
  8. def test_de_json_none(self, client):
  9. assert Plus.de_json({}, client) is None
  10. def test_de_json_required(self, client):
  11. json_dict = {'has_plus': self.has_plus, 'is_tutorial_completed': self.is_tutorial_completed}
  12. plus = Plus.de_json(json_dict, client)
  13. assert plus.has_plus == self.has_plus
  14. assert plus.is_tutorial_completed == self.is_tutorial_completed
  15. def test_de_json_all(self, client):
  16. json_dict = {'has_plus': self.has_plus, 'is_tutorial_completed': self.is_tutorial_completed}
  17. plus = Plus.de_json(json_dict, client)
  18. assert plus.has_plus == self.has_plus
  19. assert plus.is_tutorial_completed == self.is_tutorial_completed
  20. def test_equality(self):
  21. a = Plus(self.has_plus, self.is_tutorial_completed)
  22. b = Plus(self.has_plus, False)
  23. c = Plus(self.has_plus, self.is_tutorial_completed)
  24. assert a != b
  25. assert hash(a) != hash(b)
  26. assert a is not b
  27. assert a == c