55would touch the LSL network. The function takes a fresh ``StreamInfo``
66and an :class:`AxisArray`, and writes both:
77
8- * well-known stream-level `` attrs`` (``conversion``, ``offset``,
9- ``unit``) as top-level desc XML elements ; and
8+ * every stream-level entry in ``message. attrs`` as a top-level desc XML
9+ element ; and
1010* a per-channel ``<channel>`` block when the message's ``"ch"`` axis is
1111 a :class:`CoordinateAxis`.
1212"""
@@ -54,7 +54,7 @@ def _make_info(
5454
5555
5656class TestStreamLevelAttrs :
57- def test_known_attrs_emitted_as_desc_children (self ):
57+ def test_attrs_emitted_as_desc_children (self ):
5858 msg = _make_int16_msg (
5959 attrs = {
6060 "conversion" : 0.000244 ,
@@ -65,7 +65,7 @@ def test_known_attrs_emitted_as_desc_children(self):
6565 info = _make_info ()
6666 populate_desc_from_axisarray (info , msg , out_size = 3 )
6767 xml = info .as_xml ()
68- # Each promoted attr appears as a top-level <key>value</key> in desc.
68+ # Each attr appears as a top-level <key>value</key> in desc.
6969 assert "<conversion>0.000244</conversion>" in xml
7070 assert "<offset>0.0</offset>" in xml
7171 assert "<unit>a.u.</unit>" in xml
@@ -85,21 +85,16 @@ def test_missing_attrs_do_not_appear(self):
8585 assert "<offset>" not in xml
8686 assert "<unit>" not in xml
8787
88- def test_non_known_attrs_are_dropped (self ):
89- """Only the well-known attr keys ride the LSL XML.
90-
91- Other AxisArray.attrs entries stay on the message but don't
92- appear in the stream descriptor, so the on-the-wire XML stays
93- bounded regardless of how the upstream graph populates attrs.
94- """
88+ def test_arbitrary_attrs_ride_xml (self ):
89+ """All AxisArray.attrs entries land in the stream descriptor."""
9590 msg = _make_int16_msg (
96- attrs = {"conversion" : 0.5 , "ignore_me " : "private " },
91+ attrs = {"conversion" : 0.5 , "custom_key " : "custom_value " },
9792 )
9893 info = _make_info ()
9994 populate_desc_from_axisarray (info , msg , out_size = 3 )
10095 xml = info .as_xml ()
10196 assert "<conversion>0.5</conversion>" in xml
102- assert "ignore_me" not in xml
97+ assert "<custom_key>custom_value</custom_key>" in xml
10398
10499
105100class TestPerChannelLabels :
0 commit comments