diff --git a/.dir-locals.el b/.dir-locals.el index 427ee57..1fe46b5 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1 +1 @@ -((nil . ((pytest-global-name . "source secrets.sh && tox -e py34 --")))) +((nil . ((pytest-global-name . "source secrets.sh && tox -e py27,py34 --")))) diff --git a/pylast/__init__.py b/pylast/__init__.py index 9c99afe..38f3727 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1328,9 +1328,9 @@ class _BaseObject(object): def __hash__(self): # Convert any ints (or whatever) into strings - values = map(str, self._get_params().values()) + values = map(six.text_type, self._get_params().values()) - return hash(self.network) + hash(str(type(self)) + "".join( + return hash(self.network) + hash(six.text_type(type(self)) + "".join( list(self._get_params().keys()) + list(values) ).lower()) diff --git a/tests/unicode_test.py b/tests/unicode_test.py index d05c529..511ecd1 100644 --- a/tests/unicode_test.py +++ b/tests/unicode_test.py @@ -24,5 +24,6 @@ def test_get_cache_key(artist): @pytest.mark.parametrize('obj', [pylast.Artist(u'B\xe9l', mock_network())]) -def test_cast(obj): +def test_cast_and_hash(obj): assert type(six.text_type(obj)) is six.text_type + assert isinstance(hash(obj), int)