Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test insensitive to OrderedDict stringification #1353

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions tests/test_flows/test_flow_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import functools
import unittest
from collections import OrderedDict
from multiprocessing.managers import Value

from packaging.version import Version
from unittest import mock
from unittest.mock import patch
Expand Down Expand Up @@ -195,27 +197,17 @@ def test_are_flows_equal_ignore_parameter_values(self):

new_flow = copy.deepcopy(flow)
new_flow.parameters["a"] = 7
self.assertRaisesRegex(
ValueError,
r"values for attribute 'parameters' differ: "
r"'OrderedDict\(\[\('a', 5\), \('b', 6\)\]\)'\nvs\n"
r"'OrderedDict\(\[\('a', 7\), \('b', 6\)\]\)'",
openml.flows.functions.assert_flows_equal,
flow,
new_flow,
)
with pytest.raises(ValueError) as excinfo:
openml.flows.functions.assert_flows_equal(flow, new_flow)
assert str(paramaters) in str(excinfo.value) and str(new_flow.parameters) in str(excinfo.value)

openml.flows.functions.assert_flows_equal(flow, new_flow, ignore_parameter_values=True)

del new_flow.parameters["a"]
self.assertRaisesRegex(
ValueError,
r"values for attribute 'parameters' differ: "
r"'OrderedDict\(\[\('a', 5\), \('b', 6\)\]\)'\nvs\n"
r"'OrderedDict\(\[\('b', 6\)\]\)'",
openml.flows.functions.assert_flows_equal,
flow,
new_flow,
)
with pytest.raises(ValueError) as excinfo:
openml.flows.functions.assert_flows_equal(flow, new_flow)
assert str(paramaters) in str(excinfo.value) and str(new_flow.parameters) in str(excinfo.value)

self.assertRaisesRegex(
ValueError,
r"Flow Test: parameter set of flow differs from the parameters "
Expand Down
Loading