Skip to content

Commit 4a1c532

Browse files
author
Stephen Hoover
authored
TST Fix test which relied on dictionary order (#88)
Dictionaries are not guaranteed to have any order, and in particular, the order may change between Python versions. Test both possible orderings.
1 parent 45daeab commit 4a1c532

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

civis/ml/tests/test_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,9 @@ def test_modelpipeline_classmethod_constructor(mock_future,
561561

562562
@pytest.mark.skipif(not HAS_NUMPY, reason="numpy not installed")
563563
def test_modelpipeline_classmethod_constructor_nonint_id():
564+
# Verify that we can still JSON-serialize job and run IDs even
565+
# if they're entered in a non-JSON-able format.
566+
# We need to turn them into JSON to set them as script arguments.
564567
mock_client = setup_client_mock(1, 2)
565568
mock_client.scripts.get_containers.return_value = container_response_stub()
566569

@@ -569,7 +572,7 @@ def test_modelpipeline_classmethod_constructor_nonint_id():
569572

570573
out = json.dumps({'job': mp.train_result_.job_id,
571574
'run': mp.train_result_.run_id})
572-
assert out == '{"job": 1, "run": 2}'
575+
assert out == '{"job": 1, "run": 2}' or out == '{"run": 2, "job": 1}'
573576

574577

575578
@mock.patch.object(_model, 'ModelFuture', autospec=True)

0 commit comments

Comments
 (0)