Skip to content

Commit 44d5236

Browse files
[message] Add a test for message with the same old name
We want to be able to define message with the same old name that return the list of their active child.
1 parent 8f1eae6 commit 44d5236

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/message/unittest_message_definition_store.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,36 @@ def test_list_messages(self, store):
234234
def test_renamed_message_register(self, store):
235235
assert "msg-symbol" == store.get_message_definitions("W0001")[0].symbol
236236
assert "msg-symbol" == store.get_message_definitions("old-symbol")[0].symbol
237+
238+
239+
def test_multiple_child_of_old_name(store):
240+
""" We can define multiple name with the same old name. """
241+
242+
class FamillyChecker(BaseChecker):
243+
name = "famillychecker"
244+
msgs = {
245+
"W1235": (
246+
"Child 1",
247+
"child-one",
248+
"Child one description.",
249+
{"old_names": [("C1234", "mother")]},
250+
),
251+
"W1236": (
252+
"Child 2",
253+
"child-two",
254+
"Child two description",
255+
{"old_names": [("C1234", "mother")]},
256+
),
257+
}
258+
259+
store.register_messages_from_checker(FamillyChecker())
260+
mother = store.get_message_definitions("C1234")
261+
child = store.get_message_definitions("W1235")
262+
other_child = store.get_message_definitions("W1236")
263+
assert len(mother) == 2
264+
assert len(child) == 1
265+
assert len(other_child) == 1
266+
child = child[0]
267+
other_child = other_child[0]
268+
assert child in mother
269+
assert other_child in mother

0 commit comments

Comments
 (0)