Esempio n. 1
0
def test_with_unicode():
    assert isinstance(roundtrip_value(cu, 'txt', u'\xe6\xf8\xe5'), unicode)
Esempio n. 2
0
def test_utf8():
    cnx.encoding = 'utf-8'
    roundtrip_value(cu, 'x', 'abc')
    roundtrip_value(cu, 'x', u'\xef')
Esempio n. 3
0
def test_with_str():
    assert isinstance(roundtrip_value(cu, 'txt', 'abc'), unicode)
Esempio n. 4
0
def test_decimal():
    assert isinstance(roundtrip_value(cu, 'y', Decimal('1.5')), Decimal)
Esempio n. 5
0
def test_latin1():
    cnx.encoding = 'latin-1'
    roundtrip_value(cu, 'x', 'abc')
    roundtrip_value(cu, 'x', u'\xef')
Esempio n. 6
0
def test_bigint():
    assert isinstance(roundtrip_value(cu, 'w', 42), (int, long))
    assert isinstance(roundtrip_value(cu, 'w', 42L), (int, long))
    assert isinstance(roundtrip_value(cu, 'w', 2**31), (int, long))
Esempio n. 7
0
def test_real():
    assert isinstance(roundtrip_value(cu, 'x', 1.5), float)
Esempio n. 8
0
def test_integer():
    assert isinstance(roundtrip_value(cu, 'z', 42), int)
    assert isinstance(roundtrip_value(cu, 'z', 42L), int)
    assert isinstance(roundtrip_value(cu, 'z', 2**31-1), int)
Esempio n. 9
0
def test_float_into_integer():
    assert isinstance(roundtrip_value(cu, 'z', 42.0), int)
Esempio n. 10
0
def test_roundtrip_interval():
    roundtrip_value(cu, 'z', interval())
    roundtrip_value(cu, 'z', interval(seconds=1))
    roundtrip_value(cu, 'z', interval(years=1, months=2, days=3))
Esempio n. 11
0
def test_without_string_typecast():
    del cnx.typecasts['string']
    assert isinstance(roundtrip_value(cu, 'txt', 'abc'), str)
Esempio n. 12
0
def test_Date():
    roundtrip_value(cu, 'y', dbapi.Date(1979, 7, 7))
Esempio n. 13
0
def test_precise_Time():
    ts = dbapi.Time(22, 00, 12.33)
    assert str(ts) == '22:00:12.330000', str(ts)
    roundtrip_value(cu, 'w', ts)
Esempio n. 14
0
def test_precise_Timestamp():
    ts = dbapi.Timestamp(1979, 7, 7, 22, 00, 12.33)
    assert str(ts) == '1979-07-07 22:00:12.330000', str(ts)
    roundtrip_value(cu, 'x', ts)
Esempio n. 15
0
def test_Timestamp():
    roundtrip_value(cu, 'x', dbapi.Timestamp(1979, 7, 7, 22, 00, 00))
Esempio n. 16
0
def test_null():
    roundtrip_value(cu, 'x', None)
    roundtrip_value(cu, 'y', None)