From 14293aacca95c5815e94ea95e1b66bab3fc9b365 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 2 Mar 2014 14:09:57 +0200 Subject: [PATCH] Add test for hashable user. Should fail on 3.3. / cc #82 --- test_pylast.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test_pylast.py b/test_pylast.py index f5eff44..db14355 100755 --- a/test_pylast.py +++ b/test_pylast.py @@ -362,10 +362,6 @@ class TestPyLast(unittest.TestCase): def test_track_is_hashable(self): - # TODO same for some other types - # https://github.com/hugovk/pylast/issues/82 - # (passes in Python 2.7 but how about 3?) - # Arrange lastfm_user = self.network.get_user(self.username) track = lastfm_user.get_recent_tracks(limit = 2)[0] # 2 to ignore now-playing @@ -379,6 +375,23 @@ class TestPyLast(unittest.TestCase): self.assertEqual(len(tracks), 1) + def test_user_is_hashable(self): + # TODO same for some other types + # https://github.com/hugovk/pylast/issues/82 + # (passes in Python 2.7 but how about 3?) + + # Arrange + lastfm_user = self.network.get_user(self.username) + users = set() + + # Act + users.add(lastfm_user) + + # Assert + self.assertIsNotNone(lastfm_user) + self.assertEqual(len(users), 1) + + if __name__ == '__main__': # For quick testing of a single-case (eg. test = "test_scrobble")