[Sqlalchemy-commits] [5754] sqlalchemy/branches/rel_0_6: Couple more corrections to get mssql tests
Brought to you by:
zzzeek
From: <co...@sq...> - 2009-01-30 04:28:42
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[5754] sqlalchemy/branches/rel_0_6: Couple more corrections to get mssql tests to pass.</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>5754</dd> <dt>Author</dt> <dd>empty</dd> <dt>Date</dt> <dd>2009-01-29 23:28:35 -0500 (Thu, 29 Jan 2009)</dd> </dl> <h3>Log Message</h3> <pre>Couple more corrections to get mssql tests to pass.</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemybranchesrel_0_6libsqlalchemydialectsmssqlbasepy">sqlalchemy/branches/rel_0_6/lib/sqlalchemy/dialects/mssql/base.py</a></li> <li><a href="#sqlalchemybranchesrel_0_6testextcompilerpy">sqlalchemy/branches/rel_0_6/test/ext/compiler.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemybranchesrel_0_6libsqlalchemydialectsmssqlbasepy"></a> <div class="modfile"><h4>Modified: sqlalchemy/branches/rel_0_6/lib/sqlalchemy/dialects/mssql/base.py (5753 => 5754)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/branches/rel_0_6/lib/sqlalchemy/dialects/mssql/base.py 2009-01-30 01:15:05 UTC (rev 5753) +++ sqlalchemy/branches/rel_0_6/lib/sqlalchemy/dialects/mssql/base.py 2009-01-30 04:28:35 UTC (rev 5754) </span><span class="lines">@@ -1184,14 +1184,14 @@ </span><span class="cx"> if coltype == MSText or (coltype in (MSString, MSNVarchar) and charlen == -1): </span><span class="cx"> kwargs.pop('length') </span><span class="cx"> </span><del>- if issubclass(coltype, sqltypes.Numeric): - kwargs['scale'] = numericscale - kwargs['precision'] = numericprec - </del><span class="cx"> if coltype is None: </span><span class="cx"> util.warn("Did not recognize type '%s' of column '%s'" % (type, name)) </span><span class="cx"> coltype = sqltypes.NULLTYPE </span><span class="cx"> </span><ins>+ if issubclass(coltype, sqltypes.Numeric) and coltype is not MSReal: + kwargs['scale'] = numericscale + kwargs['precision'] = numericprec + </ins><span class="cx"> coltype = coltype(**kwargs) </span><span class="cx"> colargs = [] </span><span class="cx"> if default is not None: </span></span></pre></div> <a id="sqlalchemybranchesrel_0_6testextcompilerpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/branches/rel_0_6/test/ext/compiler.py (5753 => 5754)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/branches/rel_0_6/test/ext/compiler.py 2009-01-30 01:15:05 UTC (rev 5753) +++ sqlalchemy/branches/rel_0_6/test/ext/compiler.py 2009-01-30 04:28:35 UTC (rev 5754) </span><span class="lines">@@ -9,22 +9,22 @@ </span><span class="cx"> import gc </span><span class="cx"> </span><span class="cx"> class UserDefinedTest(TestBase, AssertsCompiledSQL): </span><del>- </del><ins>+ </ins><span class="cx"> def test_column(self): </span><del>- </del><ins>+ </ins><span class="cx"> class MyThingy(ColumnClause): </span><span class="cx"> __visit_name__ = 'thingy' </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self, arg= None): </span><span class="cx"> super(MyThingy, self).__init__(arg or 'MYTHINGY!') </span><del>- </del><ins>+ </ins><span class="cx"> class MyCompiler(UserDefinedCompiler): </span><span class="cx"> compile_elements = [MyThingy] </span><del>- </del><ins>+ </ins><span class="cx"> def visit_thingy(self, thingy, **kw): </span><span class="cx"> return ">>%s<<" % thingy.name </span><del>- - </del><ins>+ + </ins><span class="cx"> self.assert_compile( </span><span class="cx"> select([column('foo'), MyThingy()]), </span><span class="cx"> "SELECT foo, >>MYTHINGY!<<" </span><span class="lines">@@ -38,17 +38,17 @@ </span><span class="cx"> def test_stateful(self): </span><span class="cx"> class MyThingy(ColumnClause): </span><span class="cx"> __visit_name__ = 'thingy' </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self): </span><span class="cx"> super(MyThingy, self).__init__('MYTHINGY!') </span><del>- </del><ins>+ </ins><span class="cx"> class MyCompiler(UserDefinedCompiler): </span><span class="cx"> compile_elements = [MyThingy] </span><del>- </del><ins>+ </ins><span class="cx"> def __init__(self, parent_compiler): </span><span class="cx"> UserDefinedCompiler.__init__(self, parent_compiler) </span><span class="cx"> self.counter = 0 </span><del>- </del><ins>+ </ins><span class="cx"> def visit_thingy(self, thingy, **kw): </span><span class="cx"> self.counter += 1 </span><span class="cx"> return str(self.counter) </span><span class="lines">@@ -69,16 +69,16 @@ </span><span class="cx"> def __init__(self, table, select): </span><span class="cx"> self.table = table </span><span class="cx"> self.select = select </span><del>- </del><ins>+ </ins><span class="cx"> class MyCompiler(UserDefinedCompiler): </span><span class="cx"> compile_elements = [InsertFromSelect] </span><del>- </del><ins>+ </ins><span class="cx"> def visit_insert_from_select(self, element): </span><span class="cx"> return "INSERT INTO %s (%s)" % ( </span><span class="cx"> self.process(element.table, asfrom=True), </span><span class="cx"> self.process(element.select) </span><span class="cx"> ) </span><del>- </del><ins>+ </ins><span class="cx"> t1 = table("mytable", column('x'), column('y'), column('z')) </span><span class="cx"> self.assert_compile( </span><span class="cx"> InsertFromSelect( </span><span class="lines">@@ -104,11 +104,11 @@ </span><span class="cx"> def visit_drop_thingy(self, thingy, **kw): </span><span class="cx"> return "DROP THINGY" </span><span class="cx"> </span><del>- class MyPGCompiler(MyCompiler): - dialect = 'postgres' - </del><ins>+ class MySqliteCompiler(MyCompiler): + dialect = 'sqlite' + </ins><span class="cx"> def visit_add_thingy(self, thingy, **kw): </span><del>- return "ADD SPECIAL PG THINGY" </del><ins>+ return "ADD SPECIAL SL THINGY" </ins><span class="cx"> </span><span class="cx"> self.assert_compile(AddThingy(), </span><span class="cx"> "ADD THINGY" </span><span class="lines">@@ -120,15 +120,24 @@ </span><span class="cx"> </span><span class="cx"> from sqlalchemy.dialects.postgres import base </span><span class="cx"> self.assert_compile(AddThingy(), </span><ins>+<<<<<<< HEAD:test/ext/compiler.py </ins><span class="cx"> "ADD SPECIAL PG THINGY", </span><span class="cx"> dialect=base.dialect() </span><ins>+======= + "ADD SPECIAL SL THINGY", + dialect=create_engine('sqlite://', _initialize=False).dialect +>>>>>>> Couple more corrections to get mssql tests to pass.:test/ext/compiler.py </ins><span class="cx"> ) </span><span class="cx"> </span><span class="cx"> self.assert_compile(DropThingy(), </span><span class="cx"> "DROP THINGY", </span><ins>+<<<<<<< HEAD:test/ext/compiler.py </ins><span class="cx"> dialect=base.dialect() </span><ins>+======= + dialect=create_engine('sqlite://', _initialize=False).dialect +>>>>>>> Couple more corrections to get mssql tests to pass.:test/ext/compiler.py </ins><span class="cx"> ) </span><del>- - </del><ins>+ + </ins><span class="cx"> if __name__ == '__main__': </span><del>- testenv.main() </del><span class="cx">\ No newline at end of file </span><ins>+ testenv.main() </ins></span></pre> </div> </div> </body> </html> |