test_made_for.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. from yandex_music import MadeFor
  2. class TestMadeFor:
  3. def test_expected_values(self, made_for, user, case_forms):
  4. assert made_for.user_info == user
  5. assert made_for.case_forms == case_forms
  6. def test_de_json_none(self, client):
  7. assert MadeFor.de_json({}, client) is None
  8. def test_de_json_required(self, client, user, case_forms):
  9. json_dict = {'user_info': user.to_dict(), 'case_forms': case_forms.to_dict()}
  10. made_for = MadeFor.de_json(json_dict, client)
  11. assert made_for.user_info == user
  12. assert made_for.case_forms == case_forms
  13. def test_de_json_all(self, client, user, case_forms):
  14. json_dict = {'user_info': user.to_dict(), 'case_forms': case_forms.to_dict()}
  15. made_for = MadeFor.de_json(json_dict, client)
  16. assert made_for.user_info == user
  17. assert made_for.case_forms == case_forms
  18. def test_equality(self, user, case_forms):
  19. a = MadeFor(user, case_forms)
  20. assert a != user and a != case_forms
  21. assert hash(a) != hash(user) != hash(case_forms)