Skip to content

Commit b556966

Browse files
committed
Test integer factor in EDS.
1 parent 9ad88a7 commit b556966

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

test/sample.eds

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ ParameterName=Highest subindex
995995
ObjectType=0x7
996996
DataType=0x0005
997997
AccessType=ro
998-
DefaultValue=0x02
998+
DefaultValue=0x03
999999
PDOMapping=0x0
10001000

10011001
[3050sub1]
@@ -1018,6 +1018,16 @@ Factor=ERROR
10181018
Description=
10191019
Unit=
10201020

1021+
[3050sub3]
1022+
ParameterName=Integer Factor
1023+
ObjectType=0x7
1024+
DataType=0x0004
1025+
AccessType=ro
1026+
PDOMapping=0x0
1027+
Factor=42
1028+
Description=Should be parsed as integer
1029+
Unit=answer
1030+
10211031
[3063]
10221032
ParameterName=DOMAIN object
10231033
ObjectType=0x2

test/test_eds.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,14 @@ def test_reading_factor(self):
211211
var = self.od['EDS file extensions']['FactorAndDescription']
212212
self.assertEqual(var.factor, 0.1)
213213
self.assertEqual(var.description, "This is the a test description")
214-
self.assertEqual(var.unit,'mV')
214+
self.assertEqual(var.unit, 'mV')
215215
var2 = self.od['EDS file extensions']['Error Factor and No Description']
216216
self.assertEqual(var2.description, '')
217217
self.assertEqual(var2.factor, 1)
218218
self.assertEqual(var2.unit, '')
219+
var3 = self.od['EDS file extensions']['Integer Factor']
220+
self.assertEqual(var3.factor, 42)
221+
self.assertIsInstance(var3.factor, int)
219222

220223
def test_read_domain_object(self):
221224
var = self.od[0x3063]

0 commit comments

Comments
 (0)