def test_generate_dictionary(spark, multi_locales_df):
conn = boto3.resource('s3', region_name='us-west-2')
conn.create_bucket(Bucket=taar_utils.AMO_DUMP_BUCKET)
# Store the data in the mocked bucket.
conn.Object(taar_utils.AMO_DUMP_BUCKET, key=taar_utils.AMO_DUMP_KEY)\
.put(Body=json.dumps(FAKE_AMO_DUMP))
multi_locales_df.createOrReplaceTempView("longitudinal")
# The "en-US" locale must not be reported: we set it to a low
# frequency on |multi_locale_df|.
expected = {
"it-IT": ["test-guid-0001"]
}
assert taar_locale.generate_dictionary(spark, 5) == expected
评论列表
文章目录