tests: Add noqa markers to custom assert helpers
This commit is contained in:
parent
9f6e0cc5fa
commit
a50ba6e3a7
@ -50,28 +50,28 @@ class BaseTestCase(unittest.TestCase):
|
||||
self.session.on_receive({'received': request})
|
||||
return self.connection.response
|
||||
|
||||
def assertNoResponse(self):
|
||||
def assertNoResponse(self): # noqa: N802
|
||||
self.assertEqual([], self.connection.response)
|
||||
|
||||
def assertInResponse(self, value):
|
||||
def assertInResponse(self, value): # noqa: N802
|
||||
self.assertIn(
|
||||
value, self.connection.response,
|
||||
'Did not find %s in %s' % (
|
||||
repr(value), repr(self.connection.response)))
|
||||
|
||||
def assertOnceInResponse(self, value):
|
||||
def assertOnceInResponse(self, value): # noqa: N802
|
||||
matched = len([r for r in self.connection.response if r == value])
|
||||
self.assertEqual(
|
||||
1, matched,
|
||||
'Expected to find %s once in %s' % (
|
||||
repr(value), repr(self.connection.response)))
|
||||
|
||||
def assertNotInResponse(self, value):
|
||||
def assertNotInResponse(self, value): # noqa: N802
|
||||
self.assertNotIn(
|
||||
value, self.connection.response,
|
||||
'Found %s in %s' % (
|
||||
repr(value), repr(self.connection.response)))
|
||||
|
||||
def assertEqualResponse(self, value):
|
||||
def assertEqualResponse(self, value): # noqa: N802
|
||||
self.assertEqual(1, len(self.connection.response))
|
||||
self.assertEqual(value, self.connection.response[0])
|
||||
|
||||
@ -11,16 +11,16 @@ class IdleHandlerTest(protocol.BaseTestCase):
|
||||
def idleEvent(self, subsystem):
|
||||
self.session.on_idle(subsystem)
|
||||
|
||||
def assertEqualEvents(self, events):
|
||||
def assertEqualEvents(self, events): # noqa: N802
|
||||
self.assertEqual(set(events), self.context.events)
|
||||
|
||||
def assertEqualSubscriptions(self, events):
|
||||
def assertEqualSubscriptions(self, events): # noqa: N802
|
||||
self.assertEqual(set(events), self.context.subscriptions)
|
||||
|
||||
def assertNoEvents(self):
|
||||
def assertNoEvents(self): # noqa: N802
|
||||
self.assertEqualEvents([])
|
||||
|
||||
def assertNoSubscriptions(self):
|
||||
def assertNoSubscriptions(self): # noqa: N802
|
||||
self.assertEqualSubscriptions([])
|
||||
|
||||
def test_base_state(self):
|
||||
|
||||
@ -8,10 +8,10 @@ from mopidy.mpd import exceptions, tokenize
|
||||
|
||||
|
||||
class TestTokenizer(unittest.TestCase):
|
||||
def assertTokenizeEquals(self, expected, line):
|
||||
def assertTokenizeEquals(self, expected, line): # noqa: N802
|
||||
self.assertEqual(expected, tokenize.split(line))
|
||||
|
||||
def assertTokenizeRaises(self, exception, message, line):
|
||||
def assertTokenizeRaises(self, exception, message, line): # noqa: N802
|
||||
with self.assertRaises(exception) as cm:
|
||||
tokenize.split(line)
|
||||
self.assertEqual(cm.exception.message, message)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user