Example #1
0
 def test_with_person(self):
     person_a = Person("User", "1", None)
     person_b = Person("User", "2", person_a)
     print_depth({
         'key1': 1,
         'key2': {
             'key3': 1,
             'key4': {
                 'key5': 4,
                 'user': person_b
             }
         }
     })
     value = self.capturedOutput.getvalue()
     value = value.strip().split('\n')[-1]
     self.assertEqual(value, 'father 5', "Should pass with person")
Example #2
0
 def test_String(self):
     print_depth("Hello world")
     self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
Example #3
0
 def test_Array(self):
     print_depth([])
     self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
Example #4
0
 def test_None(self):
     print_depth(None)
     self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
Example #5
0
 def test_empty_dictionary(self):
     print_depth({})
     self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
Example #6
0
 def test_without_person(self):
     print_depth({'key1': 1, 'key2': {'key3': 1, 'key4': {'key5': 4}}})
     value = self.capturedOutput.getvalue()
     value = value.strip().split('\n')[-1]
     self.assertEqual(value, 'key5 3', "Should pass without person")