[Zope3-checkins] CVS: zopeproducts/PsycopgDA/tests - testAdapter.py:1.3

Viktorija Zaksiene ryzaja@codeworks.lt
Wed, 8 Jan 2003 11:33:47 -0500


Update of /cvs-repository/zopeproducts/PsycopgDA/tests
In directory cvs.zope.org:/tmp/cvs-serv3852/tests

Modified Files:
	testAdapter.py 
Log Message:
Fixed import and access paths.

TODO:
  - Apply grand renaming rules for PsycopgDA product.


=== zopeproducts/PsycopgDA/tests/testAdapter.py 1.2 => 1.3 ===
--- zopeproducts/PsycopgDA/tests/testAdapter.py:1.2	Tue Dec 24 04:34:30 2002
+++ zopeproducts/PsycopgDA/tests/testAdapter.py	Wed Jan  8 11:33:44 2003
@@ -19,21 +19,20 @@
 from unittest import TestCase, TestSuite, main, makeSuite
 import psycopg
 import sys
-from datetime import tzinfo
+from datetime import tzinfo, timedelta
 
 class Stub:
 
     def __init__(self, **kw):
         self.__dict__.update(kw)
 
-
 class TZStub(tzinfo):
 
     def __init__(self, h, m):
         self.offset = h * 60 + m
 
     def utcoffset(self, dt):
-        return self.offset
+        return timedelta(minutes=self.offset)
 
     def dst(self, dt):
         return 0
@@ -47,7 +46,6 @@
     def __reduce__(self):
         return type(self), (), self.__dict__
 
-
 class PsycopgStub:
 
     __shared_state = {}     # 'Borg' design pattern
@@ -75,13 +73,13 @@
 class TestPsycopgTypeConversion(TestCase):
 
     def test_conv_date(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_date
+        from zopeproducts.PsycopgDA.Adapter import _conv_date
         from datetime import date
         self.assertEquals(_conv_date(''), None)
         self.assertEquals(_conv_date('2001-03-02'), date(2001, 3, 2))
         
     def test_conv_time(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_time
+        from zopeproducts.PsycopgDA.Adapter import _conv_time
         from datetime import time
         self.assertEquals(_conv_time(''), None)
         self.assertEquals(_conv_time('23:17:57'),
@@ -90,7 +88,7 @@
                           time(23, 17, 57, 37000))
 
     def test_conv_timetz(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_timetz
+        from zopeproducts.PsycopgDA.Adapter import _conv_timetz
         from datetime import timetz
         self.assertEquals(_conv_timetz(''), None)
         self.assertEquals(_conv_timetz('12:44:01+01:00'),
@@ -99,7 +97,7 @@
                           timetz(12, 44, 01, 37000, TZStub(0,-30)))
         
     def test_conv_timestamp(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_timestamp
+        from zopeproducts.PsycopgDA.Adapter import _conv_timestamp
         from datetime import datetime
         self.assertEquals(_conv_timestamp(''), None)
         self.assertEquals(_conv_timestamp('2001-03-02 12:44:01'),
@@ -110,7 +108,7 @@
                           datetime(2001, 3, 2, 12, 44, 01, 1))
         
     def test_conv_timestamptz(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_timestamptz as c
+        from zopeproducts.PsycopgDA.Adapter import _conv_timestamptz as c
         from datetime import datetimetz
         self.assertEquals(c(''), None)
         
@@ -124,7 +122,7 @@
                   datetimetz(2001, 6, 25, 12, 14, 00, 0, TZStub(-7,0)))
 
     def test_conv_interval(self):
-        from ZopeProducts.PsycopgDA.Adapter import _conv_interval as c
+        from zopeproducts.PsycopgDA.Adapter import _conv_interval as c
         from datetime import timedelta
         self.assertEquals(c(''), None)
         self.assertEquals(c('01:00'), timedelta(hours=1))
@@ -158,16 +156,16 @@
 class TestPsycopgAdapter(TestCase):
 
     def setUp(self):
-        import ZopeProducts.PsycopgDA.Adapter as Adapter
+        import zopeproducts.PsycopgDA.Adapter as Adapter
         self.real_psycopg = Adapter.psycopg
         Adapter.psycopg = self.psycopg_stub = PsycopgStub()
 
     def tearDown(self):
-        import ZopeProducts.PsycopgDA.Adapter as Adapter
+        import zopeproducts.PsycopgDA.Adapter as Adapter
         Adapter.psycopg = self.real_psycopg
 
     def test_connection_factory(self):
-        from ZopeProducts.PsycopgDA.Adapter import PsycopgAdapter
+        from zopeproducts.PsycopgDA.Adapter import PsycopgAdapter
         a = PsycopgAdapter('dbi://username:password@hostname:port/dbname;junk=ignored')
         c = a._connection_factory()
         args = self.psycopg_stub.last_connection_string.split()
@@ -177,8 +175,8 @@
                                  'user=username'])
 
     def test_registerTypes(self):
-        import ZopeProducts.PsycopgDA.Adapter as Adapter
-        from ZopeProducts.PsycopgDA.Adapter import PsycopgAdapter
+        import zopeproducts.PsycopgDA.Adapter as Adapter
+        from zopeproducts.PsycopgDA.Adapter import PsycopgAdapter
         a = PsycopgAdapter('dbi://')
         a._registerTypes()
         for typename in ('DATE', 'TIME', 'TIMETZ', 'TIMESTAMP',
@@ -262,7 +260,7 @@
     # tzoffset is offset in minutes east of UTC
 
     def setUp(self):
-        from ZopeProducts.PsycopgDA.Adapter import parse_date, parse_time, \
+        from zopeproducts.PsycopgDA.Adapter import parse_date, parse_time, \
                                 parse_timetz, parse_datetime, parse_datetimetz
         self.parse_date = parse_date
         self.parse_time = parse_time