Пример #1
0
def test_crawl():
    for desc, name, mapping, output in (("base case", 'a', {
            'a': 5
    }, 5), ("one level", 'a.b', {
            'a': {
                'b': 5
            }
    }, 5), ("deep", 'a.b.c.d.e', {
            'a': {
                'b': {
                    'c': {
                        'd': {
                            'e': 5
                        }
                    }
                }
            }
    }, 5), ("full tree", 'a.b.c', {
            'a': {
                'b': {
                    'c': 5
                },
                'd': 6
            },
            'z': 7
    }, 5)):
        eq_.description = "crawling dotted names: %s" % desc
        yield eq_, _crawl(name, mapping), output
        del eq_.description
Пример #2
0
def test_crawl():
    for desc, name, mapping, output in (
        ("base case", 'a', {'a': 5}, 5),
        ("one level", 'a.b', {'a': {'b': 5}}, 5),
        ("deep", 'a.b.c.d.e', {'a': {'b': {'c': {'d': {'e': 5}}}}}, 5),
        ("full tree", 'a.b.c', {'a': {'b': {'c': 5}, 'd': 6}, 'z': 7}, 5)
    ):
        eq_.description = "crawling dotted names: %s" % desc
        yield eq_, _crawl(name, mapping), output
        del eq_.description
Пример #3
0
def test_crawl():
    for desc, name, mapping, output in (
        ("base case", "a", {"a": 5}, 5),
        ("one level", "a.b", {"a": {"b": 5}}, 5),
        ("deep", "a.b.c.d.e", {"a": {"b": {"c": {"d": {"e": 5}}}}}, 5),
        ("full tree", "a.b.c", {"a": {"b": {"c": 5}, "d": 6}, "z": 7}, 5),
    ):
        eq_.description = "crawling dotted names: %s" % desc
        yield eq_, _crawl(name, mapping), output
        del eq_.description