Skip to content

Commit 642e5e2

Browse files
committed
Fix: AR4 record parser returns AR3 record value
1 parent d42b196 commit 642e5e2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Komodo project files
2-
*.komodoproject
1+
#Virtual Environment
2+
*.venv
33

44
# Compiled python modules.
55
*.pyc

autosar/parser/constant_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def _parseRecordValueSpecification(self, xmlValue, parent):
137137
raise NotImplementedError(xmlElem.tag)
138138

139139
if (xmlFields is not None):
140-
record = autosar.constant.RecordValue(label, parent=parent)
140+
record = autosar.constant.RecordValueAR4(label, parent=parent)
141141
record.elements = self.parseValueV4(xmlFields, record)
142142
return record
143143
else:

tests/arxml/ar4_value_builder_test.py

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_create_record(self):
6565
package = ws.createPackage('Constants', role='Constant')
6666
c1 = package.createConstant('Result_IV', None, {'Status': 0, 'ID': 22, 'Message': 'OK'})
6767
self.assertIsInstance(c1, autosar.constant.Constant)
68+
self.assertIsInstance(c1.value, autosar.constant.RecordValueAR4)
6869

6970
file_name = 'record_constant.arxml'
7071
generated_file = os.path.join(self.output_dir, file_name)
@@ -75,6 +76,7 @@ def test_create_record(self):
7576
ws2.loadXML(os.path.join(os.path.dirname(__file__), expected_file))
7677
c2 = ws2.find(c1.ref)
7778
self.assertIsInstance(c2, autosar.constant.Constant)
79+
self.assertIsInstance(c2.value, autosar.constant.RecordValueAR4)
7880

7981
def test_create_array(self):
8082
ws = autosar.workspace(version="4.2.2")

0 commit comments

Comments
 (0)