test_id.py 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from yandex_music import Id
  2. class TestId:
  3. type = 'user'
  4. tag = 'onyourwave'
  5. def test_expected_values(self, id_):
  6. assert id_.type == self.type
  7. assert id_.tag == self.tag
  8. def test_de_json_none(self, client):
  9. assert Id.de_json({}, client) is None
  10. def test_de_json_required(self, client):
  11. json_dict = {'type': self.type, 'tag': self.tag}
  12. id_ = Id.de_json(json_dict, client)
  13. assert id_.type == self.type
  14. assert id_.tag == self.tag
  15. def test_de_json_all(self, client):
  16. json_dict = {'type': self.type, 'tag': self.tag}
  17. id_ = Id.de_json(json_dict, client)
  18. assert id_.type == self.type
  19. assert id_.tag == self.tag
  20. def test_equality(self):
  21. a = Id(self.type, self.tag)
  22. b = Id('', self.tag)
  23. c = Id(self.type, '')
  24. d = Id(self.type, self.tag)
  25. assert a != b != c
  26. assert hash(a) != hash(b) != hash(c)
  27. assert a is not b is not c
  28. assert a == d