yandex-music-api/tests/test_play_counter.py

41 行
1.6 KiB
Python
Raw Blame 履歴

このファイルには曖昧(ambiguous)なUnicode文字が含まれています

このファイルには、他の文字と見間違える可能性があるUnicode文字が含まれています。 それが意図的なものと考えられる場合は、この警告を無視して構いません。 それらの文字を表示するにはエスケープボタンを使用します。

from yandex_music import PlayCounter
class TestPlayCounter:
description = 'А вот и ответ на главный вопрос жизни, вселенной и всего такого'
value = 42
updated = True
def test_expected_values(self, play_counter):
assert play_counter.value == self.value
assert play_counter.description == self.description
assert play_counter.updated == self.updated
def test_de_json_required(self, client):
json_dict = {'value': self.value, 'description': self.description, 'updated': self.updated}
play_counter = PlayCounter.de_json(json_dict, client)
assert play_counter.value == self.value
assert play_counter.description == self.description
assert play_counter.updated == self.updated
def test_de_json_all(self, client):
json_dict = {'value': self.value, 'description': self.description, 'updated': self.updated}
play_counter = PlayCounter.de_json(json_dict, client)
assert play_counter.value == self.value
assert play_counter.description == self.description
assert play_counter.updated == self.updated
def test_equality(self):
a = PlayCounter(self.value, self.description, self.updated)
b = PlayCounter(30, self.description, self.updated)
c = PlayCounter(self.value, self.description, False)
d = PlayCounter(self.value, self.description, self.updated)
assert a != b != c
assert hash(a) != hash(b) != hash(c)
assert a is not b is not c
assert a == d