X-Git-Url: http://git.kaliko.me/?p=python-musicpd.git;a=blobdiff_plain;f=test.py;h=2c5094d9106296911223a1d3220c4213380d0f25;hp=840bd4730dd03fd76c18677ba1fa876842e20a12;hb=e616985e3da118a4e2b14afe331446633e7e2254;hpb=a8a2060756f1811f59febe11bd75521989674b83 diff --git a/test.py b/test.py index 840bd47..2c5094d 100755 --- a/test.py +++ b/test.py @@ -10,21 +10,13 @@ Test suite highly borrowed^Wsteal from python-mpd2 [0] project. import itertools import os -import sys import types import unittest +import unittest.mock as mock import warnings import musicpd -try: - import unittest.mock as mock -except ImportError: - try: - import mock - except ImportError: - print("Please install mock from PyPI to run tests!") - sys.exit(1) # show deprecation warnings warnings.simplefilter('default') @@ -123,7 +115,7 @@ class testEnvVar(unittest.TestCase): client = musicpd.MPDClient() self.assertEqual(client.mpd_timeout, musicpd.CONNECTION_TIMEOUT, - 'Garbage\'s not silently ignore to use default value') + 'Garbage is silently ignore to use default value') os.environ['MPD_TIMEOUT'] = '42' client = musicpd.MPDClient() self.assertEqual(client.mpd_timeout, 42) @@ -551,6 +543,13 @@ class TestMPDClient(unittest.TestCase): self.client.command_list_end() self.assertMPDReceived('command_list_end\n') + def test_two_word_commands(self): + self.MPDWillReturn('OK\n') + self.client.tagtypes_clear() + self.assertMPDReceived('tagtypes clear\n') + self.MPDWillReturn('OK\n') + with self.assertRaises(AttributeError): + self.client.foo_bar() class testConnection(unittest.TestCase):