test_r128.py 725 B

1234567891011121314151617181920212223242526272829303132
  1. from yandex_music import R128
  2. class TestR128:
  3. i = -13.12
  4. tp = 0.63
  5. def test_expected_values(self, r_128):
  6. assert r_128.i == self.i
  7. assert r_128.tp == self.tp
  8. def test_de_json_none(self, client):
  9. assert R128.de_json({}, client) is None
  10. def test_de_json_required(self, client):
  11. json_dict = {'i': self.i, 'tp': self.tp}
  12. r128 = R128.de_json(json_dict, client)
  13. assert r128.i == self.i
  14. assert r128.tp == self.tp
  15. def test_equality(self):
  16. a = R128(self.i, self.tp)
  17. b = R128(-8.98, self.tp)
  18. c = R128(self.i, self.tp)
  19. assert a != b
  20. assert hash(a) != hash(b)
  21. assert a is not b
  22. assert a == c