Пример #1
0
 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)
     })
Пример #2
0
 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)
     })
Пример #3
0
 def test_parse_sequence(self):
     self.data = [1, []]
     self.assertEqual(expand(self.Group(self.data)), self.data)
Пример #4
0
 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']))
Пример #5
0
 def test_expanded_parseable_type(self):
     self.assertEqual(type(expand(self.thing)), type(self.data))
Пример #6
0
 def test_expanded_parseable_value(self):
     self.assertEqual(expand(self.thing), self.data)
Пример #7
0
 def test_expand_list(self):
     data = ['test', 'ok']
     self.assertEqual(data, expand(data))
Пример #8
0
 def test_expand_dict(self):
     data = {'test': 'ok'}
     self.assertEqual(data, expand(data))