def test_get_string_with_char_delimiter(self): self.assertEqual(get(EXAMPLE_DATA, 'fruits,0,color', delimiter=','), 'yellow') self.assertEqual(get(EXAMPLE_DATA, 'vegetables 0 name'), 'green pepper') self.assertEqual( get(EXAMPLE_DATA, 'contacts|John Smith|gender', delimiter='|'), 'male') self.assertEqual( get(EXAMPLE_DATA, 'contacts|Jane Smithers|gender', delimiter='|'), 'female')
def test_no_key(self): self.assertEqual(get(EXAMPLE_DATA), EXAMPLE_DATA)
def test_get_non_existent(self): self.assertEqual(get(EXAMPLE_DATA, 'narnia'), None)
def test_get_in_list_and_dict(self): self.assertEqual(get(EXAMPLE_DATA, 'fruits', 0, 'color'), 'yellow')
def test_get_simple(self): self.assertEqual(get(EXAMPLE_DATA, 'contacts', 'John Smith', 'gender'), 'male')