test_lyrics.py 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. from yandex_music import Lyrics
  2. class TestLyrics:
  3. id = 103844
  4. lyrics = 'Too big, too small?\nSize does matter, after all\nZu groß, zu klein?\nEr könnte etwas größer sein'
  5. full_lyrics = (
  6. 'Too big, too small?\nSize does matter, after all\nZu groß, zu klein?\nEr könnte etwas größer '
  7. 'sein\n\nMercedes-Benz und Autobahn\nAlleine in das Ausland fahren\nReise, '
  8. 'Reise! Fahrvergnügen\nIch will nur Spaß, mich nicht verlieben\n\nJust a little bit...\nJust a '
  9. "little, bitch!\n\nYou've got a pussy\nI have a dick, ah.\nSo what's the problem?\nLet's do it "
  10. "quick!\n\nSo take me now, before it's too late\nLife's too short, so I can't wait\nTake me now! "
  11. "Oh, don't you see?\nI can't get laid in Germany…\n\nToo short, too tall?\nDoesn't matter, "
  12. 'one size fits all\nZu groß, zu klein?\nDer Schlagbaum sollte oben sein\n\nSchönes Fräulein, '
  13. 'Lust auf mehr\nBlitzkrieg mit dem Fleischgewehr\nSchnaps im Kopf, du holde Braut\nSteck Bratwurst '
  14. "in dein Sauerkraut\n\nJust a little bit...\nBe my little bitch!\n\nYou've got a pussy\nI have a "
  15. "dick, ah\nSo what's the problem?\nLet's do it quick!\n\nSo take me now, before it's too "
  16. "late\nLife's too short, so I can't wait\nTake me now! Oh, don't you see?\nI can't get laid in "
  17. "Germany…\n\nGermany! Germany!\n\nYou've got a pussy\nI have a dick, ah\nSo what's the "
  18. "problem?\nLet's do it quick!\n\nYou've got a pussy\nI have a dick, ah\nSo what's the "
  19. "problem?\nLet's do it quick!\n\nYou've got a pussy\nI have a dick, ah\nSo what's the "
  20. "problem?\nLet's do it quick!\n\nSo take me now, before it's too late\nLife's too short, "
  21. "so I can't wait\nTake me now! Oh, don't you see?\nI can't get laid in Germany…\n "
  22. )
  23. has_rights = True
  24. text_language = 'de'
  25. show_translation = True
  26. url = 'https://genius.com/Babyface-dont-take-it-so-personal-lyrics'
  27. def test_expected_values(self, lyrics):
  28. assert lyrics.id == self.id
  29. assert lyrics.lyrics == self.lyrics
  30. assert lyrics.full_lyrics == self.full_lyrics
  31. assert lyrics.has_rights == self.has_rights
  32. assert lyrics.text_language == self.text_language
  33. assert lyrics.show_translation == self.show_translation
  34. assert lyrics.url == self.url
  35. def test_de_json_none(self, client):
  36. assert Lyrics.de_json({}, client) is None
  37. def test_de_json_required(self, client):
  38. json_dict = {
  39. 'id': self.id,
  40. 'lyrics': self.lyrics,
  41. 'full_lyrics': self.full_lyrics,
  42. 'has_rights': self.has_rights,
  43. 'show_translation': self.show_translation,
  44. }
  45. lyrics = Lyrics.de_json(json_dict, client)
  46. assert lyrics.id == self.id
  47. assert lyrics.lyrics == self.lyrics
  48. assert lyrics.full_lyrics == self.full_lyrics
  49. assert lyrics.has_rights == self.has_rights
  50. assert lyrics.show_translation == self.show_translation
  51. def test_de_json_all(self, client):
  52. json_dict = {
  53. 'id': self.id,
  54. 'lyrics': self.lyrics,
  55. 'full_lyrics': self.full_lyrics,
  56. 'has_rights': self.has_rights,
  57. 'text_language': self.text_language,
  58. 'show_translation': self.show_translation,
  59. 'url': self.url,
  60. }
  61. lyrics = Lyrics.de_json(json_dict, client)
  62. assert lyrics.id == self.id
  63. assert lyrics.lyrics == self.lyrics
  64. assert lyrics.full_lyrics == self.full_lyrics
  65. assert lyrics.has_rights == self.has_rights
  66. assert lyrics.text_language == self.text_language
  67. assert lyrics.show_translation == self.show_translation
  68. assert lyrics.url == self.url
  69. def test_equality(self):
  70. a = Lyrics(self.id, self.lyrics, self.full_lyrics, self.has_rights, self.text_language, self.show_translation)
  71. b = Lyrics(self.id, self.lyrics, '', self.has_rights, self.text_language, False)
  72. c = Lyrics(10, self.lyrics, self.full_lyrics, self.has_rights, '', self.show_translation)
  73. d = Lyrics(self.id, self.lyrics, self.full_lyrics, self.has_rights, self.text_language, self.show_translation)
  74. assert a != b != c
  75. assert hash(a) != hash(b) != hash(c)
  76. assert a is not b is not c
  77. assert a == d