Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2
修订版 | 028ba92f3ebcc4c6974b845dde3c6c978b137193 (tree) |
---|---|
时间 | 2023-10-19 22:39:36 |
作者 | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
ASIS (busy with NameSpace: ... refactored test on search; now in NS
@@ -47,6 +47,7 @@ | ||
47 | 47 | assert False, """`aNS.getID("Deze Bestaat Niet")` should raise an error""" |
48 | 48 | except NameError: pass |
49 | 49 | |
50 | + | |
50 | 51 | def test_3_sourceNS_combi(a_node, sourceNS): |
51 | 52 | "The functionality as shown in _NS1 & _NS2 should also work with Source_NS" |
52 | 53 | name = a_node.name |
@@ -59,6 +60,7 @@ | ||
59 | 60 | assert False, """`sourceNS.getID("Deze Bestaat Niet")` should raise an error""" |
60 | 61 | except NameError: pass |
61 | 62 | |
63 | + | |
62 | 64 | def test_4_sameName_is_replaced(aNS): |
63 | 65 | logger.warning("""NOTICE: This test will issue the warning 'astle.aigr.namespaces:namespaces.py:42' You should ignore it""") |
64 | 66 | name='TriggerWarning' |
@@ -69,32 +71,6 @@ | ||
69 | 71 | aNS.register(two) |
70 | 72 | assert aNS.getID(name) is two #The test |
71 | 73 | |
72 | -def NSsearch(ns, dottedName): | |
73 | - "This functionality should be moved to namespace" | |
74 | - | |
75 | - parts = dottedName.split('.') | |
76 | - travarse, elm = parts[:-1], parts[-1] | |
77 | - | |
78 | - for name in travarse: | |
79 | - next_ns = ns.findNode(name) | |
80 | - if isinstance(next_ns, NameSpace): | |
81 | - ns = next_ns | |
82 | - else: | |
83 | - return None # no found or no namespace | |
84 | - return ns.findNode(elm) | |
85 | - | |
86 | - | |
87 | -def test_5a_ns_in_ns_with_NSsearch(): | |
88 | - "when we import a NS, we get a NS in a NS ..." | |
89 | - top = NameSpace('top') | |
90 | - sub = NameSpace('sub') | |
91 | - elm = DummyNode('elm', dummy="with.dotted.Name") | |
92 | - top.register(sub) | |
93 | - sub.register(elm) | |
94 | - | |
95 | - assert top.getID('sub') is sub | |
96 | - assert sub.getID('elm') is elm | |
97 | - assert NSsearch(top, dottedName="sub.elm") is elm | |
98 | 74 | |
99 | 75 | def test_5b_ns_in_ns(): |
100 | 76 | "when we import a NS, we get a NS in a NS ..." |
@@ -108,4 +84,7 @@ | ||
108 | 84 | assert sub.getID('elm') is elm |
109 | 85 | assert top.search(dottedName="sub.elm") is elm |
110 | 86 | |
87 | +@pytest.mark.skip("Todo: Unite `.search()` and `.find()` [& `.getID()] -- see comment in `aigr/namespaces.py`") | |
88 | +def test_to_do_Unite(): | |
89 | + assert False | |
111 | 90 |