def test_get_result_sub_path_list_fail(self): result = ['foo'] path = [2] self.assertIsNone(get_result_sub_path(result, path))
def test_get_result_sub_path_key_fail(self): result = {'foo': 'bar'} path = ['baz'] self.assertIsNone(get_result_sub_path(result, path))
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')
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)
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')
def test_get_result_sub_path_deep_list(self): result = ['foo', 'bar', 'baz'] path = [2] self.assertEquals(get_result_sub_path(result, path), 'baz')
def test_get_result_sub_path_key_fail(self): result = {"foo": "bar"} path = ["baz"] self.assertIsNone(get_result_sub_path(result, path))
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)
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")
def test_get_result_sub_path_deep_list(self): result = ["foo", "bar", "baz"] path = [2] self.assertEqual(get_result_sub_path(result, path), "baz")
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")