Ejemplo n.º 1
0
 def testListWithAListWithAnInt(self):
     item = JsonItem([[4]])
     self.assertEqual(
         '\n'.join([
             "1 list of length 1. Values:", "  1 list of length 1. Values:",
             "    1 int"
         ]), item.__str__())
Ejemplo n.º 2
0
 def testListWithTwoSameLengthDictsLengthCompare(self):
     item = JsonItem([{'a': 3}, {'b': 4}], strictness='length')
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:",
             "  2 dicts of length 1. Values:", "    1 int"
         ]), item.__str__())
Ejemplo n.º 3
0
 def testListWithOneDictAndOneInt(self):
     item = JsonItem([{}, 4])
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:", "  1 dict of length 0.",
             "  1 int"
         ]), item.__str__())
Ejemplo n.º 4
0
 def testListWithTwoUnequalListsKeysCompare(self):
     item = JsonItem([[4, 5], [6, 7]], strictness='keys')
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:", "  1 list of length 2. Values:",
             "    2 ints", "  1 list of length 2. Values:", "    2 ints"
         ]), item.__str__())
Ejemplo n.º 5
0
 def testListWithTwoEqualDictsEqualCompare(self):
     item = JsonItem([{'a': 3, 'b': 4}, {'a': 3, 'b': 4}],
                     strictness='equal')
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  2 dicts of length 2. Values:",
                                 "    2 ints"]),
                      item.__str__())
Ejemplo n.º 6
0
 def testListWithTwoDifferentLengthDictsLengthCompare(self):
     item = JsonItem([{'a': 3}, {'b': 4, 'c': 5}], strictness='length')
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:", "  1 dict of length 1. Values:",
             "    1 int", "  1 dict of length 2. Values:", "    2 ints"
         ]), item.__str__())
Ejemplo n.º 7
0
 def testListWithTwoEqualListsEqualCompare(self):
     item = JsonItem([[4, 5], [4, 5]], strictness='equal')
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:",
             "  2 lists of length 2. Values:", "    2 ints"
         ]), item.__str__())
Ejemplo n.º 8
0
 def testListWithTwoUnequalListsKeysCompare(self):
     item = JsonItem([[4, 5], [6, 7]], strictness='keys')
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  1 list of length 2. Values:",
                                 "    2 ints",
                                 "  1 list of length 2. Values:",
                                 "    2 ints"]),
                      item.__str__())
Ejemplo n.º 9
0
 def testListWithTwoDifferentLengthDictsLengthCompare(self):
     item = JsonItem([{'a': 3}, {'b': 4, 'c': 5}], strictness='length')
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  1 dict of length 1. Values:",
                                 "    1 int",
                                 "  1 dict of length 2. Values:",
                                 "    2 ints"]),
                      item.__str__())
Ejemplo n.º 10
0
 def testListWithTwoEqualDictsEqualCompare(self):
     item = JsonItem([{
         'a': 3,
         'b': 4
     }, {
         'a': 3,
         'b': 4
     }],
                     strictness='equal')
     self.assertEqual(
         '\n'.join([
             "1 list of length 2. Values:",
             "  2 dicts of length 2. Values:", "    2 ints"
         ]), item.__str__())
Ejemplo n.º 11
0
 def testDictWithOneFloatKey(self):
     item = JsonItem({'a': 4.3})
     self.assertEqual("1 dict of length 1. Values:\n  1 float",
                      item.__str__())
Ejemplo n.º 12
0
 def testListWithAListWithAnInt(self):
     item = JsonItem([[4]])
     self.assertEqual('\n'.join(["1 list of length 1. Values:",
                                 "  1 list of length 1. Values:",
                                 "    1 int"]),
                      item.__str__())
Ejemplo n.º 13
0
 def testInt(self):
     item = JsonItem(4)
     self.assertEqual("1 int",
                      item.__str__())
Ejemplo n.º 14
0
 def testDictWithOneFloatKey(self):
     item = JsonItem({'a': 4.3})
     self.assertEqual("1 dict of length 1. Values:\n  1 float",
                      item.__str__())
Ejemplo n.º 15
0
 def testListWithTwoSameLengthDictsLengthCompare(self):
     item = JsonItem([{'a': 3}, {'b': 4}], strictness='length')
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  2 dicts of length 1. Values:",
                                 "    1 int"]),
                      item.__str__())
Ejemplo n.º 16
0
 def testDictWithOneLongKey(self):
     item = JsonItem({'a': 100L})
     self.assertEqual("1 dict of length 1. Values:\n  1 long",
                      item.__str__())
Ejemplo n.º 17
0
 def testListWithOneInt(self):
     item = JsonItem([4])
     self.assertEqual("1 list of length 1. Values:\n  1 int",
                      item.__str__())
Ejemplo n.º 18
0
 def testListWithTwoInts(self):
     item = JsonItem([4, 5])
     self.assertEqual("1 list of length 2. Values:\n  2 ints",
                      item.__str__())
Ejemplo n.º 19
0
 def testDictWithOneBooleanKey(self):
     item = JsonItem({'a': True})
     self.assertEqual("1 dict of length 1. Values:\n  1 boolean",
                      item.__str__())
Ejemplo n.º 20
0
 def testDictWithOneNoneKey(self):
     item = JsonItem({'a': None})
     self.assertEqual("1 dict of length 1. Values:\n  1 None",
                      item.__str__())
Ejemplo n.º 21
0
 def testListWithAnEmptyList(self):
     item = JsonItem([[]])
     self.assertEqual("1 list of length 1. Values:\n  1 list of length 0.",
                      item.__str__())
Ejemplo n.º 22
0
 def testInt(self):
     item = JsonItem(4)
     self.assertEqual("1 int", item.__str__())
Ejemplo n.º 23
0
 def testDictWithOneBooleanKey(self):
     item = JsonItem({'a': True})
     self.assertEqual("1 dict of length 1. Values:\n  1 boolean",
                      item.__str__())
Ejemplo n.º 24
0
 def testDictWithOneNoneKey(self):
     item = JsonItem({'a': None})
     self.assertEqual("1 dict of length 1. Values:\n  1 None",
                      item.__str__())
Ejemplo n.º 25
0
 def testEmptyList(self):
     item = JsonItem([])
     self.assertEqual("1 list of length 0.", item.__str__())
Ejemplo n.º 26
0
 def testListWithOneInt(self):
     item = JsonItem([4])
     self.assertEqual("1 list of length 1. Values:\n  1 int",
                      item.__str__())
Ejemplo n.º 27
0
 def testListWithTwoInts(self):
     item = JsonItem([4, 5])
     self.assertEqual("1 list of length 2. Values:\n  2 ints",
                      item.__str__())
Ejemplo n.º 28
0
 def testListWithTwoEqualListsEqualCompare(self):
     item = JsonItem([[4, 5], [4, 5]], strictness='equal')
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  2 lists of length 2. Values:",
                                 "    2 ints"]),
                      item.__str__())
Ejemplo n.º 29
0
 def testEmptyDict(self):
     item = JsonItem({})
     self.assertEqual("1 dict of length 0.",
                      item.__str__())
Ejemplo n.º 30
0
 def testListWithOneDict(self):
     item = JsonItem([{}])
     self.assertEqual("1 list of length 1. Values:\n  1 dict of length 0.",
                      item.__str__())
Ejemplo n.º 31
0
 def testDictWithTwoStrKeys(self):
     item = JsonItem({'a': u'b', 'c': u'd'})
     self.assertEqual("1 dict of length 2. Values:\n  2 unicodes",
                      item.__str__())
Ejemplo n.º 32
0
 def testListWithAnEmptyList(self):
     item = JsonItem([[]])
     self.assertEqual("1 list of length 1. Values:\n  1 list of length 0.",
                      item.__str__())
Ejemplo n.º 33
0
 def testDictWithOneEmptyListKey(self):
     item = JsonItem({'a': []})
     self.assertEqual("1 dict of length 1. Values:\n  1 list of length 0.",
                      item.__str__())
Ejemplo n.º 34
0
 def testListWithOneDictAndOneInt(self):
     item = JsonItem([{}, 4])
     self.assertEqual('\n'.join(["1 list of length 2. Values:",
                                 "  1 dict of length 0.",
                                 "  1 int"]),
                      item.__str__())
Ejemplo n.º 35
0
 def testListWithOneDict(self):
     item = JsonItem([{}])
     self.assertEqual("1 list of length 1. Values:\n  1 dict of length 0.",
                      item.__str__())
Ejemplo n.º 36
0
 def testEmptyDict(self):
     item = JsonItem({})
     self.assertEqual("1 dict of length 0.", item.__str__())
Ejemplo n.º 37
0
 def testDictWithOneStrKey(self):
     item = JsonItem({'x': u'y'})
     self.assertEqual("1 dict of length 1. Values:\n  1 unicode",
                      item.__str__())
Ejemplo n.º 38
0
 def testEmptyList(self):
     item = JsonItem([])
     self.assertEqual("1 list of length 0.",
                      item.__str__())
Ejemplo n.º 39
0
 def testDictWithTwoStrKeys(self):
     item = JsonItem({'a': u'b', 'c': u'd'})
     self.assertEqual("1 dict of length 2. Values:\n  2 unicodes",
                      item.__str__())
Ejemplo n.º 40
0
 def testDictWithOneStrKey(self):
     item = JsonItem({'x': u'y'})
     self.assertEqual("1 dict of length 1. Values:\n  1 unicode",
                      item.__str__())
Ejemplo n.º 41
0
 def testDictWithOneEmptyListKey(self):
     item = JsonItem({'a': []})
     self.assertEqual("1 dict of length 1. Values:\n  1 list of length 0.",
                      item.__str__())
Ejemplo n.º 42
0
 def testDictWithOneIntKey(self):
     item = JsonItem({'x': 4})
     self.assertEqual("1 dict of length 1. Values:\n  1 int",
                      item.__str__())
Ejemplo n.º 43
0
 def testDictWithOneIntKey(self):
     item = JsonItem({'x': 4})
     self.assertEqual("1 dict of length 1. Values:\n  1 int",
                      item.__str__())