diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/profiling/zoomark.py | 14 | ||||
| -rw-r--r-- | test/sql/query.py | 3 | ||||
| -rw-r--r-- | test/sql/select.py | 16 | ||||
| -rw-r--r-- | test/testlib/testing.py | 8 |
4 files changed, 20 insertions, 21 deletions
diff --git a/test/profiling/zoomark.py b/test/profiling/zoomark.py index 58033ad97..6eb313b42 100644 --- a/test/profiling/zoomark.py +++ b/test/profiling/zoomark.py @@ -50,7 +50,7 @@ class ZooMarkTest(testing.AssertMixin): metadata.create_all() @testing.supported('postgres') - @profiling.profiled('populate', call_range=(3360, 4400), always=True) + @profiling.profiled('populate', call_range=(2990, 4400), always=True) def test_1a_populate(self): Zoo = metadata.tables['Zoo'] Animal = metadata.tables['Animal'] @@ -118,7 +118,7 @@ class ZooMarkTest(testing.AssertMixin): MotherID=bai_yun) @testing.supported('postgres') - @profiling.profiled('insert', call_range=(180, 250), always=True) + @profiling.profiled('insert', call_range=(160, 250), always=True) def test_2_insert(self): Animal = metadata.tables['Animal'] i = Animal.insert() @@ -126,7 +126,7 @@ class ZooMarkTest(testing.AssertMixin): tick = i.execute(Species='Tick', Name='Tick %d' % x, Legs=8) @testing.supported('postgres') - @profiling.profiled('properties', call_range=(3060, 3430), always=True) + @profiling.profiled('properties', call_range=(3030, 3430), always=True) def test_3_properties(self): Zoo = metadata.tables['Zoo'] Animal = metadata.tables['Animal'] @@ -149,7 +149,7 @@ class ZooMarkTest(testing.AssertMixin): ticks = fullobject(Animal.select(Animal.c.Species=='Tick')) @testing.supported('postgres') - @profiling.profiled('expressions', call_range=(11450, 13200), always=True) + @profiling.profiled('expressions', call_range=(11350, 13200), always=True) def test_4_expressions(self): Zoo = metadata.tables['Zoo'] Animal = metadata.tables['Animal'] @@ -203,7 +203,7 @@ class ZooMarkTest(testing.AssertMixin): assert len(fulltable(Animal.select(func.date_part('day', Animal.c.LastEscape) == 21))) == 1 @testing.supported('postgres') - @profiling.profiled('aggregates', call_range=(1020, 1270), always=True) + @profiling.profiled('aggregates', call_range=(1000, 1270), always=True) def test_5_aggregates(self): Animal = metadata.tables['Animal'] Zoo = metadata.tables['Zoo'] @@ -245,7 +245,7 @@ class ZooMarkTest(testing.AssertMixin): legs.sort() @testing.supported('postgres') - @profiling.profiled('editing', call_range=(1300, 1390), always=True) + @profiling.profiled('editing', call_range=(1280, 1390), always=True) def test_6_editing(self): Zoo = metadata.tables['Zoo'] @@ -274,7 +274,7 @@ class ZooMarkTest(testing.AssertMixin): assert SDZ['Founded'] == datetime.date(1935, 9, 13) @testing.supported('postgres') - @profiling.profiled('multiview', call_range=(2850, 3155), always=True) + @profiling.profiled('multiview', call_range=(2820, 3155), always=True) def test_7_multiview(self): Zoo = metadata.tables['Zoo'] Animal = metadata.tables['Animal'] diff --git a/test/sql/query.py b/test/sql/query.py index 67384073c..c4a3e9e0d 100644 --- a/test/sql/query.py +++ b/test/sql/query.py @@ -123,7 +123,8 @@ class QueryTest(PersistTest): continue try: table.create() - assert insert_values(table, values) == assertvalues, repr(values) + " " + repr(assertvalues) + i = insert_values(table, values) + assert i == assertvalues, repr(i) + " " + repr(assertvalues) finally: table.drop() diff --git a/test/sql/select.py b/test/sql/select.py index 56bf1d92c..ace455702 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -614,7 +614,7 @@ WHERE mytable.myid = myothertable.otherid) AS t2view WHERE t2view.mytable_myid = self.assert_compile( text("select * from foo where lala=:bar and hoho=:whee", bindparams=[bindparam('bar',4), bindparam('whee',7)]), "select * from foo where lala=? and hoho=?", - checkparams=[4, 7], + checkparams={'bar':4, 'whee':7}, dialect=dialect ) @@ -921,17 +921,19 @@ EXISTS (select yay from foo where boo = lar)", self.assert_compile(stmt, expected_positional_stmt, dialect=sqlite.dialect()) nonpositional = stmt.compile() positional = stmt.compile(dialect=sqlite.dialect()) - assert positional.get_params().get_raw_list({}) == expected_default_params_list - assert nonpositional.get_params(**test_param_dict).get_raw_dict({}) == expected_test_params_dict, "expected :%s got %s" % (str(expected_test_params_dict), str(nonpositional.get_params(**test_param_dict).get_raw_dict())) - assert positional.get_params(**test_param_dict).get_raw_list({}) == expected_test_params_list + pp = positional.get_params() + assert [pp[k] for k in positional.positiontup] == expected_default_params_list + assert nonpositional.get_params(**test_param_dict) == expected_test_params_dict, "expected :%s got %s" % (str(expected_test_params_dict), str(nonpositional.get_params(**test_param_dict).get_raw_dict())) + pp = positional.get_params(**test_param_dict) + assert [pp[k] for k in positional.positiontup] == expected_test_params_list # check that params() doesnt modify original statement s = select([table1], or_(table1.c.myid==bindparam('myid'), table2.c.otherid==bindparam('myotherid'))) s2 = s.params({'myid':8, 'myotherid':7}) s3 = s2.params({'myid':9}) - assert s.compile().params.get_original_dict() == {'myid':None, 'myotherid':None} - assert s2.compile().params.get_original_dict() == {'myid':8, 'myotherid':7} - assert s3.compile().params.get_original_dict() == {'myid':9, 'myotherid':7} + assert s.compile().params == {'myid':None, 'myotherid':None} + assert s2.compile().params == {'myid':8, 'myotherid':7} + assert s3.compile().params == {'myid':9, 'myotherid':7} # check that conflicts with "unique" params are caught diff --git a/test/testlib/testing.py b/test/testlib/testing.py index 3a2c38ce6..a1fb174b7 100644 --- a/test/testlib/testing.py +++ b/test/testlib/testing.py @@ -195,8 +195,7 @@ class ExecutionContextWrapper(object): if params is not None and not isinstance(params, list): params = [params] - from sqlalchemy.sql.util import ClauseParameters - parameters = [p.get_original_dict() for p in ctx.compiled_parameters] + parameters = ctx.compiled_parameters query = self.convert_statement(query) testdata.unittest.assert_(statement == query and (params is None or params == parameters), "Testing for query '%s' params %s, received '%s' with params %s" % (query, repr(params), statement, repr(parameters))) @@ -255,10 +254,7 @@ class SQLCompileTest(PersistTest): self.assert_(cc == result, "\n'" + cc + "'\n does not match \n'" + result + "'") if checkparams is not None: - if isinstance(checkparams, list): - self.assert_(c.params.get_raw_list({}) == checkparams, "params dont match ") - else: - self.assert_(c.params.get_original_dict() == checkparams, "params dont match" + repr(c.params)) + self.assert_(c.params == checkparams, "params dont match" + repr(c.params)) class AssertMixin(PersistTest): """given a list-based structure of keys/properties which represent information within an object structure, and |
