Exemplo n.º 1
0
    def test_error_has_useful_string_representation(self):
        error = spotify.LibError(0)
        self.assertEqual('%s' % error, 'No error')
        self.assertIsInstance('%s' % error, utils.text_type)

        error = spotify.LibError(1)
        self.assertEqual('%s' % error, 'Invalid library version')
Exemplo n.º 2
0
 def test_has_error_constants(self):
     self.assertEqual(
         spotify.LibError.OK, spotify.LibError(spotify.ErrorType.OK)
     )
     self.assertEqual(
         spotify.LibError.BAD_API_VERSION,
         spotify.LibError(spotify.ErrorType.BAD_API_VERSION),
     )
Exemplo n.º 3
0
 def test_error_has_useful_repr(self):
     error = spotify.LibError(0)
     self.assertIn('No error', repr(error))
Exemplo n.º 4
0
 def test_is_not_equal_if_different_error_type(self):
     self.assertNotEqual(spotify.LibError(0), spotify.LibError(1))
Exemplo n.º 5
0
 def test_is_equal_if_same_error_type(self):
     self.assertEqual(spotify.LibError(0), spotify.LibError(0))
Exemplo n.º 6
0
    def test_has_error_type(self):
        error = spotify.LibError(0)
        self.assertEqual(error.error_type, 0)

        error = spotify.LibError(1)
        self.assertEqual(error.error_type, 1)
Exemplo n.º 7
0
 def test_is_an_error(self):
     error = spotify.LibError(0)
     self.assertIsInstance(error, spotify.Error)