test_poetry_lover_match.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from yandex_music import PoetryLoverMatch
  2. class TestPoetryLoverMatch:
  3. begin = 18
  4. end = 25
  5. line = 3
  6. def test_expected_values(self, poetry_lover_match):
  7. assert poetry_lover_match.begin == self.begin
  8. assert poetry_lover_match.end == self.end
  9. assert poetry_lover_match.line == self.line
  10. def test_de_json_none(self, client):
  11. assert PoetryLoverMatch.de_json({}, client) is None
  12. def test_de_list_none(self, client):
  13. assert PoetryLoverMatch.de_list([], client) == []
  14. def test_de_json_required(self, client):
  15. json_dict = {'begin': self.begin, 'end': self.end, 'line': self.line}
  16. poetry_lover_match = PoetryLoverMatch.de_json(json_dict, client)
  17. assert poetry_lover_match.begin == self.begin
  18. assert poetry_lover_match.end == self.end
  19. assert poetry_lover_match.line == self.line
  20. def test_de_json_all(self, client):
  21. json_dict = {'begin': self.begin, 'end': self.end, 'line': self.line}
  22. poetry_lover_match = PoetryLoverMatch.de_json(json_dict, client)
  23. assert poetry_lover_match.begin == self.begin
  24. assert poetry_lover_match.end == self.end
  25. assert poetry_lover_match.line == self.line
  26. def test_equality(self):
  27. a = PoetryLoverMatch(self.begin, self.end, self.line)
  28. b = PoetryLoverMatch(self.begin, 10, self.line)
  29. c = PoetryLoverMatch(self.begin, self.end, self.line)
  30. assert a != b
  31. assert hash(a) != hash(b)
  32. assert a is not b
  33. assert a == c