コード例 #1
0
def test_explode_ad_click_counts(generate_main_summary_data,
                                 generate_exploded_data, df_equals):
    main_summary_with_ad_click_counts = generate_main_summary_data([{
        "scalar_parent_browser_search_ad_clicks": {
            "google": 1
        },
        "scalar_parent_browser_search_with_ads": {
            "google": 1
        },
    }])

    expected = generate_exploded_data([
        {},
        {
            "source": "ad-click:",
            "count": 1
        },
        {
            "source": "search-with-ads:",
            "count": 1
        },
    ])
    exploded = explode_search_counts(main_summary_with_ad_click_counts)

    assert df_equals(exploded, expected)
コード例 #2
0
def test_explode_search_counts_bing_absurd(generate_main_summary_data,
                                           generate_exploded_data, df_equals):
    main_summary_bing_absurd = generate_main_summary_data([{
        'search_counts': [
            generate_search_count(engine='bing',
                                  count=(MAX_CLIENT_SEARCH_COUNT + 1)),
            generate_search_count(engine='yahoo'),
        ]
    }])

    # expected result only includes yahoo, because the bing entry had an absurd
    # number of searches
    expected = generate_exploded_data([{'engine': 'yahoo'}])

    actual = explode_search_counts(main_summary_bing_absurd)

    assert df_equals(expected, actual)
コード例 #3
0
def test_explode_search_counts(simple_main_summary,
                               exploded_simple_main_summary, df_equals):
    actual = explode_search_counts(simple_main_summary)

    assert df_equals(actual, exploded_simple_main_summary)