Fix UnicodeDecodeError from #114. Replace definitions of _unicode and
_string. Add six as a dependeny. Fix clonedigger script.
This commit is contained in:
parent
1f9ebb530a
commit
df75cf2aa2
7 changed files with 54 additions and 51 deletions
|
@ -1,18 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
import pylast
|
||||
|
||||
|
||||
def mock_network():
|
||||
return mock.Mock(
|
||||
_get_ws_auth=mock.Mock(return_value=("", "", ""))
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé'])
|
||||
def test_get_cache_key(unicode_artist):
|
||||
request = pylast._Request(mock_network(), 'some_method',
|
||||
params={'artist': unicode_artist})
|
||||
request._get_cache_key()
|
28
tests/unicode_test.py
Normal file
28
tests/unicode_test.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import mock
|
||||
import pytest
|
||||
import six
|
||||
|
||||
import pylast
|
||||
|
||||
|
||||
def mock_network():
|
||||
return mock.Mock(
|
||||
_get_ws_auth=mock.Mock(return_value=("", "", ""))
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('artist', [
|
||||
u'\xe9lafdasfdsafdsa', u'ééééééé',
|
||||
pylast.Artist(u'B\xe9l', mock_network()),
|
||||
'fdasfdsafsaf not unicode',
|
||||
])
|
||||
def test_get_cache_key(artist):
|
||||
request = pylast._Request(mock_network(), 'some_method',
|
||||
params={'artist': artist})
|
||||
request._get_cache_key()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('obj', [pylast.Artist(u'B\xe9l', mock_network())])
|
||||
def test_cast(obj):
|
||||
assert type(six.text_type(obj)) is six.text_type
|
Loading…
Add table
Add a link
Reference in a new issue