Skip to content

Commit ce94631

Browse files
committed
Merge pull request #102 from tvincentNuoDB/master
Removed test_date_types_softly, increased coverage of tests
2 parents 84ba5df + 979189f commit ce94631

File tree

3 files changed

+7
-76
lines changed

3 files changed

+7
-76
lines changed

pynuodb/cursor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _reset(self):
9090

9191
def callproc(self, procname, parameters=None):
9292
"""Currently not supported."""
93-
raise NotSupportedError
93+
raise NotSupportedError("Currently unsupported")
9494

9595
def execute(self, operation, parameters=None):
9696
"""Executes an SQL operation.
@@ -190,7 +190,7 @@ def fetchall(self):
190190

191191
def nextset(self):
192192
"""Currently not supported."""
193-
raise NotSupportedError
193+
raise NotSupportedError("Currently unsupported")
194194

195195
def setinputsizes(self, sizes):
196196
"""Currently not supported."""

tests/nuodb_basic_test.py

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -439,76 +439,6 @@ def test_utf8_string_types(self):
439439
finally:
440440
con.close()
441441

442-
def DISABLE_DB10321test_date_types_softly(self):
443-
'''
444-
Just like ``test_date_types'' only this one uses EscapingTimestamps to
445-
make sure that we're testing the datetime data type, and not the
446-
implicit string conversion involved in it.
447-
'''
448-
con = self._connect()
449-
cursor = con.cursor()
450-
cursor.execute("drop table typetest if exists")
451-
try:
452-
cursor.execute("create table typetest (id integer GENERATED ALWAYS AS IDENTITY, date_col date, " +
453-
"time_col time, timestamp_col_EDT timestamp, timestamp_col_EST timestamp)")
454-
455-
test_daylight = Local.localize(
456-
EscapingTimestamp(2013, 3, 24, 12, 3, 26, 0))
457-
test_standard = Local.localize(
458-
EscapingTimestamp(2013, 11, 8, 23, 47, 32, 0))
459-
test_vals = (
460-
pynuodb.Date(2008, 1, 1),
461-
pynuodb.Time(8, 13, 34),
462-
test_daylight,
463-
test_standard
464-
)
465-
quoted_vals = ["'%s'" % str(val) for val in test_vals]
466-
for i, test_val in enumerate(test_vals):
467-
if "'" in str(test_val):
468-
quoted_vals[i] = str(test_val)
469-
exc_str = ("insert into typetest ("
470-
"date_col, "
471-
"time_col, "
472-
"timestamp_col_EDT, "
473-
"timestamp_col_EST) "
474-
"values (" + ', '.join(quoted_vals) + ")")
475-
cursor.execute(exc_str)
476-
477-
cursor.execute("select * from typetest order by id desc limit 1")
478-
row = list(cursor.fetchone())
479-
row.pop(0)
480-
res_daylight = row[2]
481-
res_standard = row[3]
482-
483-
self.assertEqual(
484-
test_daylight - test_standard,
485-
res_daylight - res_standard)
486-
487-
for res_val, test_val in zip(row, test_vals):
488-
self.assertIsInstance(test_val, type(res_val))
489-
490-
if 'year' in dir(test_val):
491-
self.assertEqual(res_val.year, test_val.year)
492-
if 'month' in dir(test_val):
493-
self.assertEqual(res_val.month, test_val.month)
494-
if 'day' in dir(test_val):
495-
self.assertEqual(res_val.day, test_val.day)
496-
497-
if 'hour' in dir(test_val):
498-
self.assertEqual(res_val.hour, test_val.hour)
499-
if 'minute' in dir(test_val):
500-
self.assertEqual(res_val.minute, test_val.minute)
501-
if 'second' in dir(test_val):
502-
self.assertEqual(res_val.second, test_val.second)
503-
if 'microsecond' in dir(test_val):
504-
self.assertEqual(res_val.microsecond, test_val.microsecond)
505-
506-
finally:
507-
try:
508-
cursor.execute("drop table typetest if exists")
509-
finally:
510-
con.close()
511-
512442
def test_date_types(self):
513443

514444
con = self._connect()
@@ -796,7 +726,7 @@ def test_all_types(self):
796726

797727
vals = (
798728
pynuodb.Binary("binary"),
799-
True,
729+
False,
800730
pynuodb.Timestamp(1990, 12, 31, 19, 0, 0),
801731
pynuodb.Time(10, 30, 44),
802732
pynuodb.Date(1998, 1, 1),

tests/nuodb_cursor_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ def test_cursor_description(self):
2323
self.assertEquals(descriptions[1][1], self.driver.NUMBER)
2424
self.assertEquals(descriptions[1][2], 11)
2525

26-
def test_cursor_rowcount_select(self):
26+
def test_cursor_rowcount_and_last_query(self):
2727
con = self._connect()
2828
cursor = con.cursor()
29-
30-
cursor.execute("SELECT 1 FROM DUAL UNION ALL SELECT 2 FROM DUAL")
29+
statement = "SELECT 1 FROM DUAL UNION ALL SELECT 2 FROM DUAL"
30+
cursor.execute(statement)
3131
self.assertEquals(cursor.rowcount, -1)
32+
self.assertEquals(cursor.query, statement)
3233

3334
def test_insufficient_parameters(self):
3435
con = self._connect()

0 commit comments

Comments
 (0)