Exemplo n.º 1
0
 def test_get_result_sub_path_list_fail(self):
     result = ['foo']
     path = [2]
     self.assertIsNone(get_result_sub_path(result, path))
Exemplo n.º 2
0
 def test_get_result_sub_path_key_fail(self):
     result = {'foo': 'bar'}
     path = ['baz']
     self.assertIsNone(get_result_sub_path(result, path))
Exemplo n.º 3
0
 def test_get_result_sub_path_deep_obj(self):
     result = ['foo', {'bar': 'baz'}, 'foobar']
     path = [1, 'bar']
     self.assertEquals(get_result_sub_path(result, path), 'baz')
Exemplo n.º 4
0
 def test_get_result_obj_path(self):
     result = ['foo', 0, {'bar': {'baz': [10, 11, 12, 13]}}]
     path = [2, 'bar', 'baz', 3]
     self.assertEquals(get_result_sub_path(result, path), 13)
Exemplo n.º 5
0
 def test_get_result_sub_path(self):
     result = [{'report': 'this_is_a_report', 'report_ref': '123/456/7'}]
     path = [0, 'report_ref']
     self.assertEquals(get_result_sub_path(result, path), '123/456/7')
Exemplo n.º 6
0
 def test_get_result_sub_path_deep_list(self):
     result = ['foo', 'bar', 'baz']
     path = [2]
     self.assertEquals(get_result_sub_path(result, path), 'baz')
Exemplo n.º 7
0
 def test_get_result_sub_path_key_fail(self):
     result = {"foo": "bar"}
     path = ["baz"]
     self.assertIsNone(get_result_sub_path(result, path))
Exemplo n.º 8
0
 def test_get_result_obj_path(self):
     result = ["foo", 0, {"bar": {"baz": [10, 11, 12, 13]}}]
     path = [2, "bar", "baz", 3]
     self.assertEqual(get_result_sub_path(result, path), 13)
Exemplo n.º 9
0
 def test_get_result_sub_path_deep_obj(self):
     result = ["foo", {"bar": "baz"}, "foobar"]
     path = [1, "bar"]
     self.assertEqual(get_result_sub_path(result, path), "baz")
Exemplo n.º 10
0
 def test_get_result_sub_path_deep_list(self):
     result = ["foo", "bar", "baz"]
     path = [2]
     self.assertEqual(get_result_sub_path(result, path), "baz")
Exemplo n.º 11
0
 def test_get_result_sub_path(self):
     result = [{"report": "this_is_a_report", "report_ref": "123/456/7"}]
     path = [0, "report_ref"]
     self.assertEqual(get_result_sub_path(result, path), "123/456/7")