Example #1
0
def test_date():
    dt = date.today()
    ret = datetime(dt.year, dt.month, dt.day).strftime("'%Y-%m-%d'")
    assert queryformat.qformat(':dt', dt=dt) == ret
Example #2
0
def test_func(f, ret):
    assert queryformat.qformat(':f', f=f) == ret
Example #3
0
def test_datetime():
    dt = datetime.utcnow()
    ret = dt.strftime("'%Y-%m-%d %H:%M:%S'")
    assert queryformat.qformat(':dt', dt=dt) == ret
Example #4
0
def test_list(ls, ret):
    assert queryformat.qformat(':ls', ls=ls) == ret
Example #5
0
def test_dict(d, ret):
    for e in queryformat.qformat(':d', d=d).split(','):
        assert e in ret.split(',')
Example #6
0
def test_none():
    assert queryformat.qformat(':n', n=None) == 'NULL'
Example #7
0
def test_bool(b, ret):
    assert queryformat.qformat(':b', b=b) == ret
Example #8
0
def test_str(s, ret):
    assert queryformat.qformat(':s', s=s) == ret
Example #9
0
def test_numbers(n):
    assert queryformat.qformat(':n', n=n) == str(n)
Example #10
0
def test_placeholoder(fmt, ret):
    assert queryformat.qformat(fmt, x='a') == ret