summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-11-11 16:51:46 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-11-11 16:51:46 -0500
commit163306cb81e4aa866972b77c3b4f142e3f1dc676 (patch)
treee3eedad17cd81ec0e7d87de08b04e80f1a17fb43 /test/sql
parent081384c56dbaa88971c8433c7152ad73d4860747 (diff)
downloadsqlalchemy-163306cb81e4aa866972b77c3b4f142e3f1dc676.tar.gz
Repair Oracle Interval
The :class:`.oracle.INTERVAL` class of the Oracle dialect is now correctly a subclass of the abstract version of :class:`.Interval` as well as the correct "emulated" base class, which allows for correct behavior under both native and non-native modes; previously it was only based on :class:`.TypeEngine`. Fixes: #4971 Change-Id: I4400d9f090330388460cca930e4139e3bd21eb11
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_types.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py
index 6359728eb..d40d0902f 100644
--- a/test/sql/test_types.py
+++ b/test/sql/test_types.py
@@ -2857,7 +2857,6 @@ class IntervalTest(fixtures.TestBase, AssertsExecutionResults):
def teardown_class(cls):
metadata.drop_all()
- @testing.fails_on("oracle", "See issue #4971")
def test_non_native_adapt(self):
interval = Interval(native=False)
adapted = interval.dialect_impl(testing.db.dialect)
@@ -2865,31 +2864,30 @@ class IntervalTest(fixtures.TestBase, AssertsExecutionResults):
assert adapted.native is False
eq_(str(adapted), "DATETIME")
- @testing.fails_on(
- "oracle",
- "ORA-01873: the leading precision of the interval is too small",
- )
def test_roundtrip(self):
small_delta = datetime.timedelta(days=15, seconds=5874)
- delta = datetime.timedelta(414)
- interval_table.insert().execute(
- native_interval=small_delta,
- native_interval_args=delta,
- non_native_interval=delta,
- )
- row = interval_table.select().execute().first()
+ delta = datetime.timedelta(14)
+ with testing.db.begin() as conn:
+ conn.execute(
+ interval_table.insert(),
+ native_interval=small_delta,
+ native_interval_args=delta,
+ non_native_interval=delta,
+ )
+ row = conn.execute(interval_table.select()).first()
eq_(row["native_interval"], small_delta)
eq_(row["native_interval_args"], delta)
eq_(row["non_native_interval"], delta)
- @testing.fails_on(
- "oracle", "ORA-00932: inconsistent datatypes: expected NUMBER got DATE"
- )
def test_null(self):
- interval_table.insert().execute(
- id=1, native_inverval=None, non_native_interval=None
- )
- row = interval_table.select().execute().first()
+ with testing.db.begin() as conn:
+ conn.execute(
+ interval_table.insert(),
+ id=1,
+ native_inverval=None,
+ non_native_interval=None,
+ )
+ row = conn.execute(interval_table.select()).first()
eq_(row["native_interval"], None)
eq_(row["native_interval_args"], None)
eq_(row["non_native_interval"], None)