[Pkg-mpd-commits] [python-mpd] 90/262: test.py Use more specific assert methods

Simon McVittie smcv at debian.org
Sun May 22 18:16:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit 05687d5636f947e2df742aec43e24b8f859386e7
Author: Jörg Thalheim <jthalheim at gmail.com>
Date:   Thu Feb 9 07:11:19 2012 +0100

    test.py Use more specific assert methods
---
 test.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/test.py b/test.py
index 09a3d7d..703ab0c 100755
--- a/test.py
+++ b/test.py
@@ -34,24 +34,24 @@ class TestMPDClient(unittest.TestCase):
         self.assertIsNone(self.client.ping())
         self.assertIsNone(self.client.clearerror())
     def test_fetch_list(self):
-        self.assertTrue(type(self.client.list("album")) == list)
+        self.assertIsInstance(self.client.list("album"), list)
     def test_fetch_item(self):
         self.assertIsNotNone(self.client.update())
     def test_fetch_object(self):
         status = self.client.status()
         stats = self.client.stats()
-        self.assertTrue(type(status) is dict)
+        self.assertIsInstance(status, dict)
         # some keys should be there
-        self.assertTrue("volume" in status)
-        self.assertTrue("song" in status)
-        self.assertTrue(type(stats) is dict)
-        self.assertTrue("artists" in stats)
-        self.assertTrue("uptime" in stats)
+        self.assertIn("volume", status)
+        self.assertIn("song", status)
+        self.assertIsInstance(stats, dict)
+        self.assertIn("artists", stats)
+        self.assertIn("uptime", stats)
     def test_fetch_songs(self):
         playlist = self.client.playlistinfo()
         self.assertTrue(type(playlist) is list)
         if len(playlist) > 0:
-                self.assertTrue(type(playlist[0]) is dict)
+                self.assertIsInstance(playlist[0], dict)
     def test_send_and_fetch(self):
         self.client.send_status()
         self.client.fetch_status()
@@ -82,7 +82,7 @@ class TestMPDClient(unittest.TestCase):
             return
         self.assertIsNone(self.client.subscribe("monty"))
         channels = self.client.channels()
-        self.assertTrue("monty" in channels)
+        self.assertIn("monty", channels)
 
         self.assertIsNone(self.client.sendmessage("monty", "SPAM"))
         msg = self.client.readmessages()
@@ -90,7 +90,7 @@ class TestMPDClient(unittest.TestCase):
 
         self.assertIsNone(self.client.unsubscribe("monty"))
         channels = self.client.channels()
-        self.assertFalse("monty" in channels)
+        self.assertNotIn("monty", channels)
 
 if __name__ == '__main__':
     unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list