File: test_country.py

package info (click to toggle)
pylast 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 296 kB
  • sloc: python: 2,564; makefile: 10
file content (40 lines) | stat: -rwxr-xr-x 1,009 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import unittest

import pylast

from .test_pylast import TestPyLastWithLastFm


class TestPyLastCountry(TestPyLastWithLastFm):
    def test_country_is_hashable(self):
        # Arrange
        country = self.network.get_country("Italy")

        # Act/Assert
        self.helper_is_thing_hashable(country)

    def test_countries(self):
        # Arrange
        country1 = pylast.Country("Italy", self.network)
        country2 = pylast.Country("Finland", self.network)

        # Act
        text = str(country1)
        rep = repr(country1)
        url = country1.get_url()

        # Assert
        self.assertIn("Italy", rep)
        self.assertIn("pylast.Country", rep)
        self.assertEqual(text, "Italy")
        self.assertEqual(country1, country1)
        self.assertNotEqual(country1, country2)
        self.assertEqual(url, "https://www.last.fm/place/italy")


if __name__ == "__main__":
    unittest.main(failfast=True)