diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-12 16:49:32 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-12 16:49:32 -0500 |
commit | b9a1e94a731b8d41b0dbac0ef565eb7d8b6ccb34 (patch) | |
tree | c197abc26d1ac2fa1186313b787463e40db5f04c | |
parent | 6efad7dfc6da0d54bb89809b12bacdf62d0169fd (diff) | |
download | sqlalchemy-b9a1e94a731b8d41b0dbac0ef565eb7d8b6ccb34.tar.gz |
adjust to allow mock DBAPIs
-rw-r--r-- | lib/sqlalchemy/dialects/oracle/cx_oracle.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index c5e24cbb3..75e6cadf5 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -348,20 +348,23 @@ class Oracle_cx_oracle(OracleDialect): cx_oracle_ver = vers(self.dbapi.version) self.supports_unicode_binds = cx_oracle_ver >= (5, 0) self._cx_oracle_native_nvarchar = cx_oracle_ver >= (5, 0) - - if self.dbapi is not None and not hasattr(self.dbapi, 'UNICODE'): - # cx_Oracle WITH_UNICODE mode. *only* python - # unicode objects accepted for anything - self._cx_oracle_string_types = set([self.dbapi.STRING]) - self.supports_unicode_statements = True - self.supports_unicode_binds = True - self._cx_oracle_with_unicode = True else: - self._cx_oracle_with_unicode = False - if self.dbapi is not None: - self._cx_oracle_string_types = set([self.dbapi.UNICODE, self.dbapi.STRING]) - else: - self._cx_oracle_string_types = set() + cx_oracle_ver = None + + if cx_oracle_ver is None: + # this occurs in tests with mock DBAPIs + self._cx_oracle_string_types = set() + self._cx_oracle_with_unicode = False + elif not hasattr(self.dbapi, 'UNICODE'): + # cx_Oracle WITH_UNICODE mode. *only* python + # unicode objects accepted for anything + self._cx_oracle_string_types = set([self.dbapi.STRING]) + self.supports_unicode_statements = True + self.supports_unicode_binds = True + self._cx_oracle_with_unicode = True + else: + self._cx_oracle_with_unicode = False + self._cx_oracle_string_types = set([self.dbapi.UNICODE, self.dbapi.STRING]) if self.dbapi is None or \ not self.auto_convert_lobs or \ |