From 1c26ef6d24539f4b68359b9fb992e8578159306d Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 7 Apr 2014 11:41:41 +0300 Subject: [PATCH] Fix tests --- setup.py | 49 +++++++++++++++++++++++++++---------------------- test_pylast.py | 16 ++++++++-------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/setup.py b/setup.py index 908dd0d..5b62429 100755 --- a/setup.py +++ b/setup.py @@ -3,30 +3,35 @@ from distutils.core import setup import os + + def get_build(): - path = "./.build" + path = "./.build" - if os.path.exists(path): - fp = open(path, "r") - build = eval(fp.read()) - if os.path.exists("./.increase_build"): - build += 1 - fp.close() - else: - build = 1 + if os.path.exists(path): + fp = open(path, "r") + build = eval(fp.read()) + if os.path.exists("./.increase_build"): + build += 1 + fp.close() + else: + build = 1 - fp = open(path, "w") - fp.write(str(build)) - fp.close() + fp = open(path, "w") + fp.write(str(build)) + fp.close() - return str(build) + return str(build) -setup(name = "pylast", - version = "0.6." + get_build(), - author = "Amr Hassan ", - description = "A Python interface to Last.fm (and other API compatible social networks)", - author_email = "amr.hassan@gmail.com", - url = "https://github.com/hugovk/", - py_modules = ("pylast",), - license = "Apache2" - ) +setup( + name="pylast", + version="0.6." + get_build(), + author="Amr Hassan ", + description="A Python interface to Last.fm (and other API compatible social networks)", + author_email="amr.hassan@gmail.com", + url="https://github.com/hugovk/pylast", + py_modules=("pylast",), + license="Apache2" + ) + +# End of file diff --git a/test_pylast.py b/test_pylast.py index f2027fe..6ec8d91 100755 --- a/test_pylast.py +++ b/test_pylast.py @@ -1606,13 +1606,13 @@ class TestPyLast(unittest.TestCase): tags_after = artist.get_tags() self.assertEqual(len(tags_after), len(tags_before) - 2) found1, found2 = False, False - for tag in tags: - if tag == "removetag1": + for tag in tags_after: + if tag.name == "removetag1": found1 = True - elif tag == "removetag2": + elif tag.name == "removetag2": found2 = True - self.assertTrue(found1) - self.assertTrue(found2) + self.assertFalse(found1) + self.assertFalse(found2) def test_set_tags(self): # Arrange @@ -1630,10 +1630,10 @@ class TestPyLast(unittest.TestCase): self.assertNotEqual(tags_before, tags_after) self.assertEqual(len(tags_after), 2) found1, found2 = False, False - for tag in tags: - if tag == "settag1": + for tag in tags_after: + if tag.name == "settag1": found1 = True - elif tag == "settag2": + elif tag.name == "settag2": found2 = True self.assertTrue(found1) self.assertTrue(found2)