Пример #1
0
    def test_time(self):
        """"Exercise TIME."""

        self.assert_compile(mysql.TIME(), "TIME")

        self.assert_compile(mysql.TIME(fsp=5), "TIME(5)")

        eq_(
            mysql.TIME().result_processor(None, None)(datetime.timedelta(
                seconds=35, minutes=517, microseconds=450)),
            datetime.time(8, 37, 35, 450))
Пример #2
0
 def test_time_result_processor(self):
     eq_(
         mysql.TIME().result_processor(None, None)(
             datetime.timedelta(seconds=35, minutes=517, microseconds=450)
         ),
         datetime.time(8, 37, 35, 450),
     )
Пример #3
0
 def test_time_roundtrip(self):
     t = Table('mysql_time', self.metadata,
             Column('t1', mysql.TIME())
         )
     t.create()
     t.insert().values(t1=datetime.time(8, 37, 35)).execute()
     eq_(select([t.c.t1]).scalar(), datetime.time(8, 37, 35))
Пример #4
0
    def test_time_generic(self):
        """"Exercise TIME."""

        self.assert_compile(
                mysql.TIME(),
                "TIME"
        )
Пример #5
0
    def test_time_roundtrip(self, metadata, connection):
        t = Table("mysql_time", metadata, Column("t1", mysql.TIME()))

        t.create(connection)

        connection.execute(t.insert().values(t1=datetime.time(8, 37, 35)))
        eq_(
            connection.execute(select(t.c.t1)).scalar(),
            datetime.time(8, 37, 35),
        )
Пример #6
0
    def test_time_roundtrip(self):
        t = Table("mysql_time", self.metadata, Column("t1", mysql.TIME()))

        with testing.db.connect() as conn:
            t.create(conn)

            conn.execute(t.insert().values(t1=datetime.time(8, 37, 35)))
            eq_(
                conn.execute(select([t.c.t1])).scalar(),
                datetime.time(8, 37, 35),
            )
Пример #7
0
 def test_time_fsp(self):
     self.assert_compile(mysql.TIME(fsp=5), "TIME(5)")