Back to Black

This commit is contained in:
Matěj Cepl 2020-10-06 08:46:05 +02:00
commit 5697ff87a8
112 changed files with 1803 additions and 977 deletions

View file

@ -49,8 +49,9 @@ def test_create_notebook_instance_minimal_params():
assert resp["NotebookInstanceArn"].endswith(args["NotebookInstanceName"])
assert resp["NotebookInstanceName"] == NAME_PARAM
assert resp["NotebookInstanceStatus"] == "InService"
assert resp["Url"] == \
"{}.notebook.{}.sagemaker.aws".format(NAME_PARAM, TEST_REGION_NAME)
assert resp["Url"] == "{}.notebook.{}.sagemaker.aws".format(
NAME_PARAM, TEST_REGION_NAME
)
assert resp["InstanceType"] == INSTANCE_TYPE_PARAM
assert resp["RoleArn"] == FAKE_ROLE_ARN
assert isinstance(resp["LastModifiedTime"], datetime.datetime)
@ -99,8 +100,9 @@ def test_create_notebook_instance_params():
assert resp["NotebookInstanceArn"].endswith(args["NotebookInstanceName"])
assert resp["NotebookInstanceName"] == NAME_PARAM
assert resp["NotebookInstanceStatus"] == "InService"
assert resp["Url"] == \
"{}.notebook.{}.sagemaker.aws".format(NAME_PARAM, TEST_REGION_NAME)
assert resp["Url"] == "{}.notebook.{}.sagemaker.aws".format(
NAME_PARAM, TEST_REGION_NAME
)
assert resp["InstanceType"] == INSTANCE_TYPE_PARAM
assert resp["RoleArn"] == FAKE_ROLE_ARN
assert isinstance(resp["LastModifiedTime"], datetime.datetime)
@ -111,8 +113,7 @@ def test_create_notebook_instance_params():
assert resp["SubnetId"] == FAKE_SUBNET_ID
assert resp["SecurityGroups"] == FAKE_SECURITY_GROUP_IDS
assert resp["KmsKeyId"] == FAKE_KMS_KEY_ID
assert resp["NotebookInstanceLifecycleConfigName"] == \
FAKE_LIFECYCLE_CONFIG_NAME
assert resp["NotebookInstanceLifecycleConfigName"] == FAKE_LIFECYCLE_CONFIG_NAME
assert resp["AcceleratorTypes"] == ACCELERATOR_TYPES_PARAM
assert resp["DefaultCodeRepository"] == FAKE_DEFAULT_CODE_REPO
assert resp["AdditionalCodeRepositories"] == FAKE_ADDL_CODE_REPOS
@ -135,9 +136,11 @@ def test_create_notebook_instance_bad_volume_size():
}
with pytest.raises(ParamValidationError) as ex:
sagemaker.create_notebook_instance(**args)
assert \
ex.value.args[0] == \
"Parameter validation failed:\nInvalid range for parameter VolumeSizeInGB, value: {}, valid range: 5-inf".format(vol_size)
assert ex.value.args[
0
] == "Parameter validation failed:\nInvalid range for parameter VolumeSizeInGB, value: {}, valid range: 5-inf".format(
vol_size
)
@mock_sagemaker
@ -238,17 +241,15 @@ def test_notebook_instance_lifecycle_config():
OnCreate=on_create,
OnStart=on_start,
)
assert \
e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config already exists.)"
)
assert e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config already exists.)"
)
resp = sagemaker.describe_notebook_instance_lifecycle_config(
NotebookInstanceLifecycleConfigName=name,
)
assert resp["NotebookInstanceLifecycleConfigName"] == name
assert \
resp["NotebookInstanceLifecycleConfigArn"].startswith("arn:aws:sagemaker")
assert resp["NotebookInstanceLifecycleConfigArn"].startswith("arn:aws:sagemaker")
assert resp["NotebookInstanceLifecycleConfigArn"].endswith(name)
assert resp["OnStart"] == on_start
assert resp["OnCreate"] == on_create
@ -263,16 +264,14 @@ def test_notebook_instance_lifecycle_config():
sagemaker.describe_notebook_instance_lifecycle_config(
NotebookInstanceLifecycleConfigName=name,
)
assert \
e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config does not exist.)"
)
assert e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config does not exist.)"
)
with pytest.raises(ClientError) as e:
sagemaker.delete_notebook_instance_lifecycle_config(
NotebookInstanceLifecycleConfigName=name,
)
assert \
e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config does not exist.)"
)
assert e.value.response["Error"]["Message"].endswith(
"Notebook Instance Lifecycle Config does not exist.)"
)