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")
def test_String(self): print_depth("Hello world") self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
def test_Array(self): print_depth([]) self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
def test_None(self): print_depth(None) self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
def test_empty_dictionary(self): print_depth({}) self.assertEqual(self.capturedOutput.getvalue(), '', "Should be empty")
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")