• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

修订版8948acb0b11d8f3dd091c9ebe4a9852b4dcca7fd (tree)
时间2023-10-20 22:45:25
作者Albert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

ASIS (more test on namednode/NamedNode interaction: 2ways is limited

更改概述

差异

diff -r 43d9cfa74f23 -r 8948acb0b11d castle/aigr/namednodes.py
--- a/castle/aigr/namednodes.py Fri Oct 20 15:22:22 2023 +0200
+++ b/castle/aigr/namednodes.py Fri Oct 20 15:45:25 2023 +0200
@@ -23,3 +23,7 @@
2323 def register_in_NS(self, ns):
2424 self._ns = ns
2525
26+ @property
27+ def ns(self):
28+ return self._ns
29+
diff -r 43d9cfa74f23 -r 8948acb0b11d pytst/aigr/test_3_namespaces.py
--- a/pytst/aigr/test_3_namespaces.py Fri Oct 20 15:22:22 2023 +0200
+++ b/pytst/aigr/test_3_namespaces.py Fri Oct 20 15:45:25 2023 +0200
@@ -84,8 +84,20 @@
8484 assert sub.getID('elm') is elm
8585 assert top.search(dottedName="sub.elm") is elm
8686
87-def test_6_registered_is_2way(aNS, a_node):
88- assert a_node._ns is aNS
87+def test_6a_registered_is_2ways(aNS, a_node):
88+ """When a NamedNode is registered in a NameSpace, it should a backlink (`ns property) to the NS again"""
89+ assert a_node.ns is aNS
90+
91+def test_6b_registered_is_2ways_once(aNS, a_node):
92+ """Currently, a NamedNode can be registered in multiple namespaces, but the backlink is always the last
93+ XXX ToDo: is that the intent? For now test as is"""
94+ name = a_node.name
95+ other = NameSpace('other')
96+ other.register(a_node)
97+
98+ assert (aNS.getID(name) is a_node) and (other.getID(name) is a_node), "A NamedNode can be registered in two NS'ses ..."
99+ assert a_node.ns is other, " ...but Only the last NS is remembered"
100+
89101
90102
91103 @pytest.mark.skip("Todo: Unite `.search()` and `.find()` [& `.getID()] -- see comment in `aigr/namespaces.py`")