Beispiel #1
0
def test_statistics_object_creation_from_string_without_customizations():
    with open(os.path.join(tests.integ.DATA_DIR, "monitor/statistics.json"), "r") as f:
        file_body = f.read()

    statistics = Statistics.from_string(statistics_file_string=file_body)

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

    assert statistics.body_dict["dataset"]["item_count"] == 418
def test_statistics_object_creation_from_string_with_customizations(
        sagemaker_session, monitoring_files_kms_key):
    with open(os.path.join(tests.integ.DATA_DIR, "monitor/statistics.json"),
              "r") as f:
        file_body = f.read()

    statistics = Statistics.from_string(
        statistics_file_string=file_body,
        kms_key=monitoring_files_kms_key,
        file_name="statistics.json",
        sagemaker_session=sagemaker_session,
    )

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

    assert statistics.body_dict["dataset"]["item_count"] == 418