Skip to content

Commit aaa495e

Browse files
committed
Small changes requested by the maintainers
1 parent f1c01e4 commit aaa495e

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

canopen/objectdictionary/eds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def import_eds(source, node_id):
129129
storage_location = None
130130

131131
if object_type in (objectcodes.VAR, objectcodes.DOMAIN):
132-
var = build_variable(eds, section, node_id, index, is_domain=object_type==objectcodes.DOMAIN)
132+
var = build_variable(eds, section, node_id, index, is_domain=object_type == objectcodes.DOMAIN)
133133
od.add_object(var)
134134
elif object_type == objectcodes.ARRAY and eds.has_option(section, "CompactSubObj"):
135135
arr = ODArray(name, index)
@@ -162,7 +162,7 @@ def import_eds(source, node_id):
162162
object_type = int(eds.get(section, "ObjectType"), 0)
163163
except NoOptionError:
164164
object_type = objectcodes.VAR
165-
var = build_variable(eds, section, node_id, index, subindex, is_domain=object_type==objectcodes.DOMAIN)
165+
var = build_variable(eds, section, node_id, index, subindex, is_domain=object_type == objectcodes.DOMAIN)
166166
entry.add_member(var)
167167

168168
# Match [index]Name

test/test_eds.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_variable(self):
111111
self.assertEqual(var.name, 'Producer heartbeat time')
112112
self.assertEqual(var.data_type, canopen.objectdictionary.UNSIGNED16)
113113
self.assertEqual(var.access_type, 'rw')
114-
self.assertEqual(var.is_domain, False)
114+
self.assertFalse(var.is_domain)
115115
self.assertEqual(var.default, 0)
116116
self.assertFalse(var.relative)
117117

@@ -133,7 +133,7 @@ def test_record(self):
133133
self.assertEqual(var.subindex, 1)
134134
self.assertEqual(var.data_type, canopen.objectdictionary.UNSIGNED32)
135135
self.assertEqual(var.access_type, 'ro')
136-
self.assertEqual(var.is_domain, False)
136+
self.assertFalse(var.is_domain)
137137

138138
def test_record_with_limits(self):
139139
int8 = self.od[0x3020]
@@ -168,7 +168,7 @@ def test_array_compact_subobj(self):
168168
self.assertEqual(var.subindex, 5)
169169
self.assertEqual(var.data_type, canopen.objectdictionary.UNSIGNED32)
170170
self.assertEqual(var.access_type, 'ro')
171-
self.assertEqual(var.is_domain, False)
171+
self.assertFalse(var.is_domain)
172172

173173
def test_explicit_name_subobj(self):
174174
name = self.od[0x3004].name
@@ -200,7 +200,7 @@ def test_dummy_variable(self):
200200
self.assertEqual(var.name, 'Dummy0003')
201201
self.assertEqual(var.data_type, canopen.objectdictionary.INTEGER16)
202202
self.assertEqual(var.access_type, 'const')
203-
self.assertEqual(var.is_domain, False)
203+
self.assertFalse(var.is_domain)
204204
self.assertEqual(len(var), 16)
205205

206206
def test_dummy_variable_undefined(self):
@@ -225,7 +225,7 @@ def test_read_domain_object(self):
225225
self.assertEqual(var.name, 'DOMAIN object')
226226
self.assertEqual(var.data_type, canopen.objectdictionary.UNSIGNED32)
227227
self.assertEqual(var.access_type, 'rw')
228-
self.assertEqual(var.is_domain, True)
228+
self.assertTrue(var.is_domain)
229229

230230
def test_read_domain_subobject(self):
231231
record = self.od[0x3064]
@@ -236,7 +236,7 @@ def test_read_domain_subobject(self):
236236
self.assertEqual(var.name, 'DOMAIN sub-object')
237237
self.assertEqual(var.data_type, canopen.objectdictionary.UNSIGNED32)
238238
self.assertEqual(var.access_type, 'rw')
239-
self.assertEqual(var.is_domain, True)
239+
self.assertTrue(var.is_domain)
240240

241241
def test_roundtrip_domain_objects(self):
242242
# ObjectType==DOMAIN survive an EDS export/import round-trip
@@ -246,10 +246,10 @@ def test_roundtrip_domain_objects(self):
246246
dest.name = 'mock.eds'
247247
dest.seek(0)
248248
od2 = canopen.import_od(dest)
249-
self.assertEqual(od2['Producer heartbeat time'].is_domain, False)
250-
self.assertEqual(od2['Identity object']['Vendor-ID'].is_domain, False)
251-
self.assertEqual(od2[0x3063].is_domain, True)
252-
self.assertEqual(od2[0x3064][1].is_domain, True)
249+
self.assertFalse(od2['Producer heartbeat time'].is_domain)
250+
self.assertFalse(od2['Identity object']['Vendor-ID'].is_domain)
251+
self.assertTrue(od2[0x3063].is_domain)
252+
self.assertTrue(od2[0x3064][1].is_domain)
253253

254254

255255
def test_comments(self):

0 commit comments

Comments
 (0)