Exemple #1
0
    def test_traverse_dict(self):
        test_two_level_dict = {"foo": {"bar": "baz"}}

        self.assertDictEqual(
            {"not_found": "nope"}, utils.traverse_dict(test_two_level_dict, "foo:bar:baz", {"not_found": "nope"})
        )
        self.assertEqual("baz", utils.traverse_dict(test_two_level_dict, "foo:bar", {"not_found": "not_found"}))
    def test_traverse_dict(self):
        test_two_level_dict = {'foo': {'bar': 'baz'}}

        self.assertDictEqual({'not_found': 'nope'},
                             utils.traverse_dict(test_two_level_dict,
                                                 'foo:bar:baz',
                                                 {'not_found': 'nope'}))
        self.assertEqual(
            'baz',
            utils.traverse_dict(test_two_level_dict, 'foo:bar',
                                {'not_found': 'not_found'}))
Exemple #3
0
    def test_traverse_dict(self):
        test_two_level_dict = {'foo': {'bar': 'baz'}}

        self.assertDictEqual(
            {'not_found': 'nope'},
            utils.traverse_dict(
                test_two_level_dict, 'foo:bar:baz', {'not_found': 'nope'}
            )
        )
        self.assertEqual(
            'baz',
            utils.traverse_dict(
                test_two_level_dict, 'foo:bar', {'not_found': 'not_found'}
            )
        )