Exemplo n.º 1
0
def test_mysql_list_compare_with_none():
    assert sql_query_dict._mysql_clause(
        'x!=', [None, 1, 2, 3], '%s'
    ) == " ((x IS NOT NULL) AND  (x NOT IN (1,2,3)) ) "
    assert sql_query_dict._mysql_clause(
        'x',   [None, 1, 2, 3], '%s'
    ) == " ((x IS NULL) OR  (x IN (1,2,3)) ) "
Exemplo n.º 2
0
def test_mysql_not_in():
    assert sql_query_dict._mysql_clause('x!=', [1, 2, 3], '%s') == \
        " (x NOT IN (1,2,3)) "
Exemplo n.º 3
0
def test_mysql_not_like():
    assert sql_query_dict._mysql_clause('x!~', 'the %', '%s') == \
        " (x NOT LIKE %s) "
Exemplo n.º 4
0
def test_mysql_string_value():
    assert sql_query_dict._mysql_clause('x', 'the', '%s') == \
        " (x = %s) "
Exemplo n.º 5
0
def test_mysql_list_with_generator():
    assert sql_query_dict._mysql_clause(
        'x', (x for x in [1, 2, 3]), '%s'
    ) == " (x IN (1,2,3)) "
Exemplo n.º 6
0
def test_mysql_list_with_none():
    assert sql_query_dict._mysql_clause('x', [None, False], '%s') == \
        ' ((x IS NULL) OR  (x IN (False)) ) '
Exemplo n.º 7
0
def test_mysql_list_with_or_equals():
    assert sql_query_dict._mysql_clause('x|=', [1, 2, 3], '%s') == \
        " (x IN (1,2,3)) "