'Ensure timezone-aware datetimes are converted to timestamps correctly'

def test_timezone_aware_datetimes_are_timestamps(self):

    try:
        import pytz
    except ImportError as exc:
        raise unittest.SkipTest(('pytz    is    not    available:    %r' % (exc,)))
    dt = datetime(1997, 8, 29, 11, 14)
    eastern_tz = pytz.timezone('US/Eastern')
    eastern_tz.localize(dt)
    s = self.session
    s.execute('CREATE    TABLE    tz_aware    (a    ascii    PRIMARY    KEY,    b    timestamp)')
    s.execute("INSERT    INTO    tz_aware    (a,    b)    VALUES    ('key1',    %s)", [dt])
    result = s.execute("SELECT    b    FROM    tz_aware    WHERE    a='key1'")[0].b
    self.assertEqual(dt.utctimetuple(), result.utctimetuple())
    insert = s.prepare("INSERT    INTO    tz_aware    (a,    b)    VALUES    ('key2',    ?)")
    s.execute(insert.bind([dt]))
    result = s.execute("SELECT    b    FROM    tz_aware    WHERE    a='key2'")[0].b
    self.assertEqual(dt.utctimetuple(), result.utctimetuple())
