test_track_position.py 1.1 KB

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