Skip to content

Commit b7e273b

Browse files
committed
MAINT/flow add sentinel to name instead of external version
1 parent e42ca51 commit b7e273b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/test_flows/test_flow.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,16 @@ def test_sklearn_to_upload_to_flow(self):
199199
rs.fit(X, y)
200200
flow = openml.flows.sklearn_to_flow(rs)
201201

202-
# Add the sentinel to all external version strings in all subflows
202+
# Add the sentinel to all name strings in all subflows. Adds it to
203+
# name to make it easier in the web gui to see that the flow is only
204+
# a test flow
203205
to_visit = collections.deque()
204206
to_visit.appendleft(flow)
205207
while len(to_visit) > 0:
206208
current_flow = to_visit.pop()
207209
for sub_flow in current_flow.components.values():
208210
to_visit.appendleft(sub_flow)
209-
current_flow.external_version = sentinel + current_flow.external_version
211+
current_flow.name = sentinel + current_flow.name
210212

211213
flow.publish()
212214
self.assertIsInstance(flow.flow_id, int)
@@ -227,8 +229,10 @@ def test_sklearn_to_upload_to_flow(self):
227229

228230
for i in range(10):
229231
# Make sure that we replace all occurences of two newlines
232+
local_xml = local_xml.replace(sentinel, '')
230233
local_xml = local_xml.replace(' ', '').replace('\t', '').strip().replace('\n\n', '\n').replace('"', '"')
231234
local_xml = re.sub(r'(^$)', '', local_xml)
235+
server_xml = server_xml.replace(sentinel, '')
232236
server_xml = server_xml.replace(' ', '').replace('\t', '').strip().replace('\n\n', '\n').replace('"', '"')
233237
server_xml = re.sub(r'^$', '', server_xml)
234238

@@ -237,15 +241,16 @@ def test_sklearn_to_upload_to_flow(self):
237241
self.assertTrue(are_flows_equal(new_flow, flow))
238242
self.assertIsNot(new_flow, flow)
239243

240-
fixture_name = 'sklearn.model_selection._search.RandomizedSearchCV(' \
244+
fixture_name = '%ssklearn.model_selection._search.RandomizedSearchCV(' \
241245
'estimator=sklearn.pipeline.Pipeline(' \
242246
'steps__ohe=sklearn.preprocessing.data.OneHotEncoder,' \
243247
'steps__scaler=sklearn.preprocessing.data.StandardScaler,' \
244248
'steps__fu=sklearn.pipeline.FeatureUnion(' \
245249
'transformer_list__pca=sklearn.decomposition.truncated_svd.TruncatedSVD,' \
246250
'transformer_list__fs=sklearn.feature_selection.univariate_selection.SelectPercentile),' \
247251
'steps__boosting=sklearn.ensemble.weight_boosting.AdaBoostClassifier(' \
248-
'base_estimator=sklearn.tree.tree.DecisionTreeClassifier)))'
252+
'base_estimator=sklearn.tree.tree.DecisionTreeClassifier)))' \
253+
% sentinel
249254

250255
self.assertEqual(new_flow.name, fixture_name)
251256

0 commit comments

Comments
 (0)