Skip to content

Commit b9d8425

Browse files
committed
rename function from check_X to assert_X
1 parent 61fd0ca commit b9d8425

6 files changed

Lines changed: 17 additions & 17 deletions

File tree

openml/flows/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .flow import OpenMLFlow
22
from .sklearn_converter import sklearn_to_flow, flow_to_sklearn
3-
from .functions import get_flow, list_flows, flow_exists, check_flows_equal
3+
from .functions import get_flow, list_flows, flow_exists, assert_flows_equal
44

55
__all__ = ['OpenMLFlow', 'create_flow_from_model', 'get_flow', 'list_flows',
66
'sklearn_to_flow', 'flow_to_sklearn', 'flow_exists']

openml/flows/flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,4 +358,4 @@ def _check_flow(flow):
358358
import openml.flows.functions
359359

360360
flow_copy = openml.flows.functions.get_flow(flow.flow_id)
361-
openml.flows.functions.check_flows_equal(flow, flow_copy)
361+
openml.flows.functions.assert_flows_equal(flow, flow_copy)

openml/flows/functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _list_flows(api_call):
130130
return flows
131131

132132

133-
def check_flows_equal(flow1, flow2):
133+
def assert_flows_equal(flow1, flow2):
134134
"""Check equality of two flows.
135135
136136
Two flows are equal if their all keys which are not set by the server
@@ -164,7 +164,7 @@ def check_flows_equal(flow1, flow2):
164164
if not name in attr2:
165165
raise ValueError('Component %s only available in '
166166
'argument2, but not in argument1.' % name)
167-
check_flows_equal(attr1[name], attr2[name])
167+
assert_flows_equal(attr1[name], attr2[name])
168168

169169
else:
170170
if attr1 != attr2:

tests/test_flows/test_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_to_xml_from_xml(self):
9898
new_flow = openml.flows.OpenMLFlow._from_dict(xml_dict)
9999

100100
# Would raise exception if they are not legal
101-
openml.flows.functions.check_flows_equal(new_flow, flow)
101+
openml.flows.functions.assert_flows_equal(new_flow, flow)
102102
self.assertIsNot(new_flow, flow)
103103

104104
def test_publish_flow(self):
@@ -260,7 +260,7 @@ def test_sklearn_to_upload_to_flow(self):
260260
self.assertEqual(server_xml, local_xml)
261261

262262
# Would raise exception if they are not equal!
263-
openml.flows.functions.check_flows_equal(new_flow, flow)
263+
openml.flows.functions.assert_flows_equal(new_flow, flow)
264264
self.assertIsNot(new_flow, flow)
265265

266266
fixture_name = '%ssklearn.model_selection._search.RandomizedSearchCV(' \

tests/test_flows/test_flow_functions.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_are_flows_equal(self):
5858
custom_name='Test')
5959

6060
# Test most important values that can be set by a user
61-
openml.flows.functions.check_flows_equal(flow, flow)
61+
openml.flows.functions.assert_flows_equal(flow, flow)
6262
for attribute, new_value in [('name', 'Tes'),
6363
('description', 'Test flo'),
6464
('external_version', '2'),
@@ -70,11 +70,11 @@ def test_are_flows_equal(self):
7070
new_flow = copy.deepcopy(flow)
7171
setattr(new_flow, attribute, new_value)
7272
self.assertNotEqual(getattr(flow, attribute), getattr(new_flow, attribute))
73-
self.assertRaises(ValueError, openml.flows.functions.check_flows_equal,
73+
self.assertRaises(ValueError, openml.flows.functions.assert_flows_equal,
7474
flow, new_flow)
7575

7676
# Test that the API ignores several keys when comparing flows
77-
openml.flows.functions.check_flows_equal(flow, flow)
77+
openml.flows.functions.assert_flows_equal(flow, flow)
7878
for attribute, new_value in [('flow_id', 1),
7979
('uploader', 1),
8080
('version', 1),
@@ -86,27 +86,27 @@ def test_are_flows_equal(self):
8686
new_flow = copy.deepcopy(flow)
8787
setattr(new_flow, attribute, new_value)
8888
self.assertNotEqual(getattr(flow, attribute), getattr(new_flow, attribute))
89-
openml.flows.functions.check_flows_equal(flow, new_flow)
89+
openml.flows.functions.assert_flows_equal(flow, new_flow)
9090

9191
# Now test for parameters
9292
flow.parameters['abc'] = 1.0
9393
flow.parameters['def'] = 2.0
94-
openml.flows.functions.check_flows_equal(flow, flow)
94+
openml.flows.functions.assert_flows_equal(flow, flow)
9595
new_flow = copy.deepcopy(flow)
9696
new_flow.parameters['abc'] = 3.0
97-
self.assertRaises(ValueError, openml.flows.functions.check_flows_equal,
97+
self.assertRaises(ValueError, openml.flows.functions.assert_flows_equal,
9898
flow, new_flow)
9999

100100
# Now test for components (subflows)
101101
parent_flow = copy.deepcopy(flow)
102102
subflow = copy.deepcopy(flow)
103103
parent_flow.components['subflow'] = subflow
104-
openml.flows.functions.check_flows_equal(parent_flow, parent_flow)
104+
openml.flows.functions.assert_flows_equal(parent_flow, parent_flow)
105105
self.assertRaises(ValueError,
106-
openml.flows.functions.check_flows_equal,
106+
openml.flows.functions.assert_flows_equal,
107107
parent_flow, subflow)
108108
new_flow = copy.deepcopy(parent_flow)
109109
new_flow.components['subflow'].name = 'Subflow name'
110110
self.assertRaises(ValueError,
111-
openml.flows.functions.check_flows_equal,
111+
openml.flows.functions.assert_flows_equal,
112112
parent_flow, new_flow)

tests/test_flows/test_sklearn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import sklearn.tree
2626

2727
from openml.flows import OpenMLFlow, sklearn_to_flow, flow_to_sklearn
28-
from openml.flows.functions import check_flows_equal
28+
from openml.flows.functions import assert_flows_equal
2929
from openml.flows.sklearn_converter import _format_external_version, _check_dependencies
3030
from openml.exceptions import PyOpenMLError
3131

@@ -295,7 +295,7 @@ def test_serialize_complex_flow(self):
295295
serialized2 = sklearn_to_flow(deserialized)
296296
self.assertNotEqual(rs, deserialized)
297297
# Would raise an exception if the flows would be unequal
298-
check_flows_equal(serialized, serialized2)
298+
assert_flows_equal(serialized, serialized2)
299299

300300
def test_serialize_type(self):
301301
supported_types = [float, np.float, np.float32, np.float64,

0 commit comments

Comments
 (0)