示例#1
0
 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()
示例#2
0
 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()
示例#3
0
 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()
示例#4
0
 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()
示例#5
0
 def test_matches(self):
     matcher = search._Matcher('album', None, lambda x: x)
     self.assertRaises(NotImplementedError, matcher._matches, 'foo')
示例#6
0
 def test_matches(self):
     matcher = search._Matcher('album', None, lambda x: x)
     with pytest.raises(NotImplementedError):
         matcher._matches('foo')
示例#7
0
 def test_matches(self):
     matcher = search._Matcher('album', None, lambda x: x)
     with pytest.raises(NotImplementedError):
         matcher._matches('foo')