2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import CaseForms
|
|
|
|
|
|
|
|
|
|
|
|
class TestCaseForms:
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
nominative = 'Илья'
|
|
|
|
genitive = 'Ильи'
|
|
|
|
dative = 'Илье'
|
|
|
|
accusative = 'Илью'
|
|
|
|
instrumental = 'Ильей'
|
|
|
|
prepositional = 'Илье'
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, case_forms):
|
|
|
|
assert case_forms.nominative == self.nominative
|
|
|
|
assert case_forms.genitive == self.genitive
|
|
|
|
assert case_forms.dative == self.dative
|
|
|
|
assert case_forms.accusative == self.accusative
|
|
|
|
assert case_forms.instrumental == self.instrumental
|
|
|
|
assert case_forms.prepositional == self.prepositional
|
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert CaseForms.de_json({}, client) is None
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'nominative': self.nominative,
|
|
|
|
'genitive': self.genitive,
|
|
|
|
'dative': self.dative,
|
|
|
|
'accusative': self.accusative,
|
|
|
|
'instrumental': self.instrumental,
|
|
|
|
'prepositional': self.prepositional,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
case_forms = CaseForms.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert case_forms.nominative == self.nominative
|
|
|
|
assert case_forms.genitive == self.genitive
|
|
|
|
assert case_forms.dative == self.dative
|
|
|
|
assert case_forms.accusative == self.accusative
|
|
|
|
assert case_forms.instrumental == self.instrumental
|
|
|
|
assert case_forms.prepositional == self.prepositional
|
|
|
|
|
|
|
|
def test_de_json_all(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'nominative': self.nominative,
|
|
|
|
'genitive': self.genitive,
|
|
|
|
'dative': self.dative,
|
|
|
|
'accusative': self.accusative,
|
|
|
|
'instrumental': self.instrumental,
|
|
|
|
'prepositional': self.prepositional,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
case_forms = CaseForms.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert case_forms.nominative == self.nominative
|
|
|
|
assert case_forms.genitive == self.genitive
|
|
|
|
assert case_forms.dative == self.dative
|
|
|
|
assert case_forms.accusative == self.accusative
|
|
|
|
assert case_forms.instrumental == self.instrumental
|
|
|
|
assert case_forms.prepositional == self.prepositional
|
|
|
|
|
|
|
|
def test_equality(self):
|
2021-02-03 21:28:10 +09:00
|
|
|
a = CaseForms(
|
|
|
|
self.nominative, self.genitive, self.dative, self.accusative, self.instrumental, self.prepositional
|
|
|
|
)
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
b = CaseForms(self.nominative, '', self.dative, self.accusative, self.instrumental, self.prepositional)
|
2021-02-03 21:28:10 +09:00
|
|
|
c = CaseForms(
|
|
|
|
self.nominative, self.genitive, self.dative, self.accusative, self.instrumental, self.prepositional
|
|
|
|
)
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|