Пример #1
0
def test_constraint_violations_object_creation_from_file_path_without_customizations():
    constraint_violations = ConstraintViolations.from_file_path(
        constraint_violations_file_path=os.path.join(
            tests.integ.DATA_DIR, "monitor/constraint_violations.json"
        )
    )

    assert constraint_violations.file_s3_uri.startswith("s3://")
    assert constraint_violations.file_s3_uri.endswith("constraint_violations.json")

    assert constraint_violations.body_dict["violations"][0]["feature_name"] == "store_and_fwd_flag"
def test_constraint_violations_object_creation_from_file_path_with_customizations(
        sagemaker_session, monitoring_files_kms_key):
    constraint_violations = ConstraintViolations.from_file_path(
        constraint_violations_file_path=os.path.join(
            tests.integ.DATA_DIR, "monitor/constraint_violations.json"),
        kms_key=monitoring_files_kms_key,
        sagemaker_session=sagemaker_session,
    )

    assert constraint_violations.file_s3_uri.startswith("s3://")
    assert constraint_violations.file_s3_uri.endswith(
        "constraint_violations.json")

    assert constraint_violations.body_dict["violations"][0][
        "feature_name"] == "store_and_fwd_flag"