コード例 #1
0
def test_boolean_true():
    url = "/v1/company_query_builder?ecommerce=true"
    response = get_es_query(url)
    assert response == full_es_query(
        {'term': {
            'ecommerce.is_ecommerce': True
        }})
コード例 #2
0
def test_range_top_end():
    url = "/v1/company_query_builder?revenue=-100"
    response = get_es_query(url)
    assert response == revenue_range_template(None, 100)
コード例 #3
0
def test_range_bottom_end():
    url = "/v1/company_query_builder?revenue=1-"
    response = get_es_query(url)
    assert response == revenue_range_template(1, None)
コード例 #4
0
def test_range_both_ends():
    url = "/v1/company_query_builder?revenue=1-100"
    response = get_es_query(url)
    assert response == revenue_range_template(1, 100)
コード例 #5
0
def test_all(url):
    get_es_query(url)
コード例 #6
0
def test_lte_lessThan_gte():
    url = "/v1/company_query_builder?revenue=-1--100"
    with pytest.raises(Exception):
        response = get_es_query(url)
コード例 #7
0
def test_negative_lte_gte():
    url = "/v1/company_query_builder?revenue=-100--1"
    response = get_es_query(url)
    assert response == revenue_range_template(-100, -1)
コード例 #8
0
def test_date_range_upper_end():
    url = "/v1/company_query_builder?trading_activity=-20160101"
    response = get_es_query(url)
    assert response == trade_activity_template(None, "2016-01-01")
コード例 #9
0
def test_date_range_bottom_end():
    url = "/v1/company_query_builder?trading_activity=20150101-"
    response = get_es_query(url)
    assert response == trade_activity_template("2015-01-01", None)
コード例 #10
0
def test_boolean_false():
    url = "/v1/company_query_builder?ecommerce=false"
    response = get_es_query(url)
    assert response == full_es_query(None)