def test_bad_index(self): sot = schema.AnyIndexDict('*') ex = self.assertRaises(KeyError, sot.__getitem__, 'foo') # the following test is not interesting self.assertEqual("'Invalid key foo'", str(ex))
def test_basic(self): sot = schema.AnyIndexDict('*') self.assertIsInstance(sot, collections.Mapping) self.assertEqual('*', sot.value) self.assertEqual('*', sot[1]) self.assertEqual('*', sot[2]) self.assertEqual('*', sot['*']) for a in sot: self.assertEqual('*', a) self.assertEqual(1, len(sot))