示例#1
0
    def test_escaped_values(self):
        column = Column('id', str)
        value = "test 'escaped' string"
        assert column.escape(value) == "'test ''escaped'' string'"

        value = 'test "double quotes"'
        assert column.escape(value) == "'{}'".format(value)
示例#2
0
 def test_bytes(self):
     column = Column('id', str)
     value = b'bytes string'
     assert column.escape(value) == "'bytes string'"
示例#3
0
 def test_int(self):
     column = Column('id', int)
     assert column.escape('22') == 22
示例#4
0
 def test_casts_datetime(self):
     value = datetime(2016, 1, 1, 0, 0, 0)
     column = Column('name', datetime)
     assert column.escape(value) == "'{}'".format(str(value))