• R/O
  • SSH

Commit

Tags
Aucun tag

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

Révisionee362a7af3ee8a822d276ba285c284084e59073f (tree)
l'heure2023-10-05 06:54:55
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

Improved MuMut coverage

Change Summary

Modification

diff -r 04f1dce1fca3 -r ee362a7af3ee Makefile
--- a/Makefile Wed Oct 04 23:01:53 2023 +0200
+++ b/Makefile Wed Oct 04 23:54:55 2023 +0200
@@ -21,6 +21,7 @@
2121 #
2222 rPY_CURRENT = \
2323 pytst/aigr/test_2c_GenericProtocols.py \
24+ pytst/aigr/test_0_aid.py \
2425 #
2526 CC2CPy_TODO = \
2627 pytst/writers/RPy/test_999.py \
diff -r 04f1dce1fca3 -r ee362a7af3ee castle/aigr/protocols.py
--- a/castle/aigr/protocols.py Wed Oct 04 23:01:53 2023 +0200
+++ b/castle/aigr/protocols.py Wed Oct 04 23:54:55 2023 +0200
@@ -40,7 +40,7 @@
4040
4141 name: str
4242 kind: ProtocolKind
43- based_on: PTH.Optional[Protocol]=dc_field(default_factory= lambda :Protocol._BASE)
43+ based_on: PTH.Optional[Protocol]=dc_field(default_factory= lambda :Protocol._BASE) # pragma: no mutate
4444 typedParameters: PTH.Optional[PTH.Sequence[TypedParameter]]=()
4545
4646
@@ -56,15 +56,17 @@
5656 @dataclass # pragma: no mutate
5757 class StreamProtocol(Protocol): pass ### XXX ToDo (not exported)
5858
59+
60+marker_kind=object() # pragma: no mutate -- Just an unknown, unique marker
5961 @dataclass # pragma: no mutate
6062 class ProtocolWrapper(Protocol):
6163 name: str=""
62- kind : ProtocolKind=None
64+ kind : ProtocolKind=marker_kind
6365 _: KW_ONLY
64- arguments: PTH.Sequence[Argument]=()
66+ arguments: PTH.Sequence[Argument]
6567
6668 def __post_init__(self):
67- if not self.kind:
69+ if self.kind is marker_kind:
6870 self.kind = self.based_on.kind
6971 if self.name == "":
7072 self.name = f"Wrapper for {self.based_on.name}({self.arguments})"
diff -r 04f1dce1fca3 -r ee362a7af3ee pytst/aigr/test_0_aid.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pytst/aigr/test_0_aid.py Wed Oct 04 23:54:55 2023 +0200
@@ -0,0 +1,12 @@
1+# (C) Albert Mietus, 2023. Part of Castle/CCastle project
2+
3+import logging; logger = logging.getLogger(__name__)
4+import pytest
5+
6+from castle.aigr import aid
7+
8+def test_Argument_with_NoName():
9+ a = aid.Argument(value=1)
10+
11+ assert a.name == None
12+ assert a.value == 1
diff -r 04f1dce1fca3 -r ee362a7af3ee pytst/aigr/test_2c_GenericProtocols.py
--- a/pytst/aigr/test_2c_GenericProtocols.py Wed Oct 04 23:01:53 2023 +0200
+++ b/pytst/aigr/test_2c_GenericProtocols.py Wed Oct 04 23:54:55 2023 +0200
@@ -65,11 +65,6 @@
6565 def sub_b(base):
6666 return EventProtocol("Sub_b", events=[], based_on=ProtocolWrapper(based_on=base, arguments=(Argument(value=1),)))
6767
68-@pytest.fixture
69-def sub_strange(base):
70- return EventProtocol("SubStrange", events=[], based_on=ProtocolWrapper(name="Strange", kind=42,
71- based_on=base, arguments=(Argument(value=1),)))
72-
7368 def assert_GP_kind(base, sub):
7469 assert sub.kind == base.kind
7570 assert sub.based_on.kind == base.kind
@@ -94,7 +89,23 @@
9489 assert_GP_name(base, sub_b)
9590 assert "queue_max" not in sub_b.based_on.name # the argument-name is only in the (a) version
9691
97-def test_strange(sub_strange):
92+
93+
94+def test_strange_1(base):
9895 """This is (very) atypical use -- but it helps to get coverage"""
96+ sub_strange = EventProtocol("SubStrange", events=[], based_on=ProtocolWrapper(name="Strange",
97+ kind=42,
98+ based_on=base,
99+ arguments=(Argument(value=1),)))
99100 assert sub_strange.based_on.name == "Strange"
100101 assert sub_strange.based_on.kind == 42, "When we set a strange kind-number it should be stored"
102+
103+def test_strange_2(base):
104+ """This is (very) atypical use -- but it helps to get coverage"""
105+ sub_strange = EventProtocol("SubStrange", events=[], based_on=ProtocolWrapper(name="Strange",
106+ kind=None,
107+ based_on=base,
108+ arguments=(Argument(value=1),)))
109+
110+ assert sub_strange.based_on.name == "Strange"
111+