Skip to content

Commit 247f180

Browse files
committed
ignore tags in flow comparison
1 parent d70eea6 commit 247f180

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

openml/flows/functions.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ def assert_flows_equal(flow1, flow2, ignore_parameters_on_older_children=None,
175175

176176
# TODO as they are actually now saved during publish, it might be good to
177177
# check for the equality of these as well.
178-
generated_by_the_server = ['flow_id', 'uploader', 'version', 'upload_date']
178+
generated_by_the_server = ['flow_id', 'uploader', 'version', 'upload_date',
179+
# Tags aren't directly created by the server,
180+
# but the uploader has no control over them!
181+
'tags']
179182
ignored_by_python_API = ['binary_url', 'binary_format', 'binary_md5',
180183
'model']
181184

@@ -208,15 +211,7 @@ def assert_flows_equal(flow1, flow2, ignore_parameters_on_older_children=None,
208211
elif ignore_parameters:
209212
continue
210213

211-
if key == 'tags':
212-
if set(attr1) != set(attr2):
213-
raise ValueError(
214-
"Flow %s: values for attribute '%s' differ: "
215-
"'%s' vs '%s'." %
216-
(str(flow1.name), str(key), str(set(attr1)),
217-
str(set(attr2))))
218-
219-
elif attr1 != attr2:
214+
if attr1 != attr2:
220215
raise ValueError("Flow %s: values for attribute '%s' differ: "
221216
"'%s' vs '%s'." %
222217
(str(flow1.name), str(key), str(attr1), str(attr2)))

tests/test_flows/test_flow_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def test_are_flows_equal(self):
6363
for attribute, new_value in [('name', 'Tes'),
6464
('description', 'Test flo'),
6565
('external_version', '2'),
66-
('tags', ['abc', 'de']),
6766
('language', 'english'),
6867
('dependencies', 'ab'),
6968
('class_name', 'Tes'),
@@ -83,7 +82,8 @@ def test_are_flows_equal(self):
8382
('binary_url', 'openml.org'),
8483
('binary_format', 'gzip'),
8584
('binary_md5', '12345'),
86-
('model', [])]:
85+
('model', []),
86+
('tags', ['abc', 'de'])]:
8787
new_flow = copy.deepcopy(flow)
8888
setattr(new_flow, attribute, new_value)
8989
self.assertNotEqual(getattr(flow, attribute), getattr(new_flow, attribute))

0 commit comments

Comments
 (0)