def test_modify_node():
    node = ast_call("estimator.create_model(image=my_image)")
    modifier = renamed_params.EstimatorCreateModelImageURIRenamer()
    modifier.modify_node(node)

    expected = "estimator.create_model(image_uri=my_image)"
    assert expected == pasta.dump(node)
def test_node_should_be_modified_no_distribution():
    modifier = renamed_params.EstimatorCreateModelImageURIRenamer()

    for estimator in ESTIMATORS:
        call = "{}.create_model()".format(estimator)
        assert not modifier.node_should_be_modified(ast_call(call))
def test_node_should_be_modified_random_function_call():
    modifier = renamed_params.EstimatorCreateModelImageURIRenamer()
    assert not modifier.node_should_be_modified(ast_call("create_model()"))
def test_node_should_be_modified():
    modifier = renamed_params.EstimatorCreateModelImageURIRenamer()

    for estimator in ESTIMATORS:
        call = "{}.create_model(image='my-image:latest')".format(estimator)
        assert modifier.node_should_be_modified(ast_call(call))