def test_match_list_none(self): self.mox.StubOutWithMock(search._Matcher, '_matches') search._Matcher._matches(None).AndReturn(True) self.mox.ReplayAll() matcher = search._Matcher('album', None, lambda x: x) self.assertTrue(matcher.match(self.str)) self.mox.VerifyAll()
def test_match_list_true(self): self.mox.StubOutWithMock(search._Matcher, '_matches') search._Matcher._matches(mox.IsA(basestring)).AndReturn(True) self.mox.ReplayAll() matcher = search._Matcher('artist', u'bar', lambda x: x) self.assertTrue(matcher.match(self.str)) self.mox.VerifyAll()
def test_match_list_false(self): self.mox.StubOutWithMock(search._Matcher, '_matches') # ensure that both tags are checked search._Matcher._matches(mox.IsA(basestring)).AndReturn(False) search._Matcher._matches(mox.IsA(basestring)).AndReturn(False) self.mox.ReplayAll() matcher = search._Matcher('artist', u'bar', lambda x: x) assert not matcher.match(self.strack) self.mox.VerifyAll()
def test_matches(self): matcher = search._Matcher('album', None, lambda x: x) self.assertRaises(NotImplementedError, matcher._matches, 'foo')
def test_matches(self): matcher = search._Matcher('album', None, lambda x: x) with pytest.raises(NotImplementedError): matcher._matches('foo')