Example #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)) ) "
Example #2
0
def test_mysql_not_in():
    assert sql_query_dict._mysql_clause('x!=', [1, 2, 3], '%s') == \
        " (x NOT IN (1,2,3)) "
Example #3
0
def test_mysql_not_like():
    assert sql_query_dict._mysql_clause('x!~', 'the %', '%s') == \
        " (x NOT LIKE %s) "
Example #4
0
def test_mysql_string_value():
    assert sql_query_dict._mysql_clause('x', 'the', '%s') == \
        " (x = %s) "
Example #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)) "
Example #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)) ) '
Example #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)) "