def test_usernouse(self): user1 = self.UserNoUse({'id': 1, 'name': 'Joe'}) user2 = self.UserNoUse({'id': 2, 'name': 'Jack', 'best_friend': user1}) self.assertRaises(SchemaError, self.UserNoUse, { 'id': 3, 'name': 'Jill', 'best_friend': expand(user1) })
def test_useruse(self): user1 = self.UserUse({'id': 1, 'name': 'Joe'}) user2 = self.UserUse({'id': 2, 'name': 'Jack', 'best_friend': user1}) user3 = self.UserUse({ 'id': 3, 'name': 'Jill', 'best_friend': expand(user1) })
def test_parse_sequence(self): self.data = [1, []] self.assertEqual(expand(self.Group(self.data)), self.data)
def test_expanded_subparseable_type(self): self.assertEqual(type(expand(self.message)), type(self.data)) self.assertEqual(type(expand(self.message['from'])), type(self.data['from']))
def test_expanded_parseable_type(self): self.assertEqual(type(expand(self.thing)), type(self.data))
def test_expanded_parseable_value(self): self.assertEqual(expand(self.thing), self.data)
def test_expand_list(self): data = ['test', 'ok'] self.assertEqual(data, expand(data))
def test_expand_dict(self): data = {'test': 'ok'} self.assertEqual(data, expand(data))