diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-24 17:08:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-24 17:08:02 -0400 |
commit | 0198d9aa5fee96c7523cc3e827baaba442c0ba02 (patch) | |
tree | e74c0a712877afeed670350ebea0d223d6b852c1 | |
parent | 96f49085b8dd05062b97c4f9c892c071042dad66 (diff) | |
download | sqlalchemy-0198d9aa5fee96c7523cc3e827baaba442c0ba02.tar.gz |
- break out binary insert against None, disable for freetds for now
-rw-r--r-- | test/dialect/mssql/test_types.py | 49 | ||||
-rw-r--r-- | test/requirements.py | 5 |
2 files changed, 41 insertions, 13 deletions
diff --git a/test/dialect/mssql/test_types.py b/test/dialect/mssql/test_types.py index 5c9157379..a0f674a61 100644 --- a/test/dialect/mssql/test_types.py +++ b/test/dialect/mssql/test_types.py @@ -772,18 +772,6 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults): pickled=testobj2, ) - # TODO: pyodbc does not seem to accept "None" for a VARBINARY - # column (data=None). error: [Microsoft][ODBC SQL Server - # Driver][SQL Server]Implicit conversion from data type varchar - # to varbinary is not allowed. Use the CONVERT function to run - # this query. (257) binary_table.insert().execute(primary_id=3, - # misc='binary_data_two.dat', data=None, data_image=None, - # data_slice=stream2[0:99], pickled=None) - - binary_table.insert().execute( - primary_id=3, - misc='binary_data_two.dat', data_image=None, - data_slice=stream2[0:99], pickled=None) for stmt in \ binary_table.select(order_by=binary_table.c.primary_id), \ text( @@ -807,6 +795,43 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults): eq_(testobj3.moredata, l[0]['mypickle'].moredata) eq_(l[0]['mypickle'].stuff, 'this is the right stuff') + @testing.requires.no_mssql_freetds + def test_binary_none(self): + # TODO: pyodbc does not seem to accept "None" for a VARBINARY + # column (data=None). error: [Microsoft][ODBC SQL Server + # Driver][SQL Server]Implicit conversion from data type varchar + # to varbinary is not allowed. Use the CONVERT function to run + # this query. (257) binary_table.insert().execute(primary_id=3, + # misc='binary_data_two.dat', data=None, data_image=None, + # data_slice=stream2[0:99], pickled=None) + + stream2 = self.load_stream('binary_data_two.dat') + + binary_table.insert().execute( + primary_id=3, + misc='binary_data_two.dat', data_image=None, + data_slice=stream2[0:99], pickled=None) + for stmt in \ + binary_table.select(), \ + text( + 'select * from binary_table', + typemap=dict( + data=mssql.MSVarBinary(8000), + data_image=mssql.MSImage, + data_slice=types.BINARY(100), pickled=PickleType, + mypickle=MyPickleType), + bind=testing.db): + row = stmt.execute().first() + eq_( + row['pickled'], None + ) + eq_( + row['data_image'], None + ) + eq_( + row['data_slice'], stream2[0:99] + ) + def load_stream(self, name, len=3000): fp = open( os.path.join(os.path.dirname(__file__), "..", "..", name), 'rb') diff --git a/test/requirements.py b/test/requirements.py index e993be2e7..db5e65f4c 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -811,11 +811,14 @@ class DefaultRequirements(SuiteRequirements): ) @property + def no_mssql_freetds(self): + return self.mssql_freetds.not_() + + @property def selectone(self): """target driver must support the literal statement 'select 1'""" return skip_if(["oracle", "firebird"], "non-standard SELECT scalar syntax") - @property def mysql_fully_case_sensitive(self): return only_if(self._has_mysql_fully_case_sensitive) |