Skip to content

Commit f65a1fb

Browse files
eds: revert LowLimit/HighLimit parse error to silent pass, remove warning test
1 parent bf972c1 commit f65a1fb

2 files changed

Lines changed: 2 additions & 19 deletions

File tree

canopen/objectdictionary/eds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def build_variable(
306306
else:
307307
var.min = int(min_string, 0)
308308
except ValueError:
309-
logger.warning("Failed to parse LowLimit for %s: %r", name, min_string)
309+
pass
310310
if eds.has_option(section, "HighLimit"):
311311
try:
312312
max_string = eds.get(section, "HighLimit")
@@ -315,7 +315,7 @@ def build_variable(
315315
else:
316316
var.max = int(max_string, 0)
317317
except ValueError:
318-
logger.warning("Failed to parse HighLimit for %s: %r", name, max_string)
318+
pass
319319
if eds.has_option(section, "DefaultValue"):
320320
try:
321321
var.default_raw = eds.get(section, "DefaultValue")

test/test_eds.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,6 @@ def test_record_with_limits(self):
154154
self.assertEqual(var.min, -1, f"min mismatch at 0x{index:04X}")
155155
self.assertEqual(var.max, 0, f"max mismatch at 0x{index:04X}")
156156

157-
def test_invalid_limit_logs_warning(self):
158-
import io
159-
import logging
160-
161-
with open(SAMPLE_EDS) as f:
162-
content = f.read()
163-
invalid_eds = content.replace(
164-
"LowLimit=0x02\nPDOMapping=0\n\n[3030]",
165-
"LowLimit=INVALID\nPDOMapping=0\n\n[3030]",
166-
)
167-
with io.StringIO(invalid_eds) as buf:
168-
buf.name = "mock.eds"
169-
with self.assertLogs("canopen.objectdictionary.eds", level=logging.WARNING) as cm:
170-
od = canopen.import_od(buf)
171-
self.assertIsNone(od[0x3021].min)
172-
self.assertTrue(any("LowLimit" in msg for msg in cm.output))
173-
174157
def test_signed_int_from_hex(self):
175158
for data_type, test_cases in self.test_data.items():
176159
for test_case in test_cases:

0 commit comments

Comments
 (0)