def test_list_match(self): mspec = mim.match({'foo.bar': 4}, {'foo': {'bar': [1, 2, 3, 4, 5]}}) self.assertEqual( mspec, mim.MatchDoc({ 'foo': mim.MatchDoc({'bar': mim.MatchList([1, 2, 3, 4, 5], pos=3)}) })) self.assertEqual(mspec.getvalue('foo.bar.$'), 4)
def test_dotted_match(self): mspec = mim.match({'foo.bar': 4}, {'foo': {'bar': 4}}) self.assertEqual(mspec, mim.MatchDoc({'foo': mim.MatchDoc({'bar': 4})}))
def test_simple_match(self): mspec = mim.match({'foo': 4}, {'foo': 4}) self.assertEqual(mspec, mim.MatchDoc({'foo': 4}))