summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/profiling/compiler.py6
-rw-r--r--test/profiling/zoomark.py8
-rw-r--r--test/profiling/zoomark_orm.py4
-rw-r--r--test/sql/labels.py37
4 files changed, 38 insertions, 17 deletions
diff --git a/test/profiling/compiler.py b/test/profiling/compiler.py
index 278d32827..5be8c0f8e 100644
--- a/test/profiling/compiler.py
+++ b/test/profiling/compiler.py
@@ -15,15 +15,15 @@ class CompileTest(TestBase, AssertsExecutionResults):
Column('c1', Integer, primary_key=True),
Column('c2', String(30)))
- @profiling.function_call_count(72, {'2.4': 42})
+ @profiling.function_call_count(68, {'2.4': 42})
def test_insert(self):
t1.insert().compile()
- @profiling.function_call_count(70, {'2.4': 45})
+ @profiling.function_call_count(68, {'2.4': 45})
def test_update(self):
t1.update().compile()
- @profiling.function_call_count(202, versions={'2.4':133})
+ @profiling.function_call_count(195, versions={'2.4':133})
def test_select(self):
s = select([t1], t1.c.c2==t2.c.c1)
s.compile()
diff --git a/test/profiling/zoomark.py b/test/profiling/zoomark.py
index eb21c141e..08215454a 100644
--- a/test/profiling/zoomark.py
+++ b/test/profiling/zoomark.py
@@ -332,11 +332,11 @@ class ZooMarkTest(TestBase):
def test_profile_2_insert(self):
self.test_baseline_2_insert()
- @profiling.function_call_count(4178, {'2.4': 2557})
+ @profiling.function_call_count(3858, {'2.4': 2557})
def test_profile_3_properties(self):
self.test_baseline_3_properties()
- @profiling.function_call_count(15869, {'2.4': 10549})
+ @profiling.function_call_count(14752, {'2.4': 10549})
def test_profile_4_expressions(self):
self.test_baseline_4_expressions()
@@ -344,11 +344,11 @@ class ZooMarkTest(TestBase):
def test_profile_5_aggregates(self):
self.test_baseline_5_aggregates()
- @profiling.function_call_count(2054, {'2.4': 1256})
+ @profiling.function_call_count(1904, {'2.4': 1256})
def test_profile_6_editing(self):
self.test_baseline_6_editing()
- @profiling.function_call_count(3276, {'2.4': 2198})
+ @profiling.function_call_count(3110, {'2.4': 2198})
def test_profile_7_multiview(self):
self.test_baseline_7_multiview()
diff --git a/test/profiling/zoomark_orm.py b/test/profiling/zoomark_orm.py
index 784bb35a2..3fff96e1a 100644
--- a/test/profiling/zoomark_orm.py
+++ b/test/profiling/zoomark_orm.py
@@ -298,11 +298,11 @@ class ZooMarkTest(TestBase):
def test_profile_2_insert(self):
self.test_baseline_2_insert()
- @profiling.function_call_count(7305)
+ @profiling.function_call_count(6765)
def test_profile_3_properties(self):
self.test_baseline_3_properties()
- @profiling.function_call_count(25760)
+ @profiling.function_call_count(23957)
def test_profile_4_expressions(self):
self.test_baseline_4_expressions()
diff --git a/test/sql/labels.py b/test/sql/labels.py
index a0f49f3f1..5a620be8c 100644
--- a/test/sql/labels.py
+++ b/test/sql/labels.py
@@ -110,14 +110,6 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
@testing.requires.subqueries
def test_subquery(self):
- # this is the test that fails if the "max identifier length" is
- # shorter than the length of the actual columns created, because the
- # column names get truncated. if you try to separate "physical
- # columns" from "labels", and only truncate the labels, the
- # compiler.DefaultCompiler.visit_select() logic which auto-labels
- # columns in a subquery (for the purposes of sqlite compat) breaks the
- # code, since it is creating "labels" on the fly but not affecting
- # derived columns, which think they are still "physical"
q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias('foo')
x = select([q])
print x.execute().fetchall()
@@ -137,5 +129,34 @@ class LongLabelsTest(TestBase, AssertsCompiledSQL):
print x.execute().fetchall()
+ def test_adjustable(self):
+
+ q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias('foo')
+ x = select([q])
+
+ compile_dialect = default.DefaultDialect(label_length=10)
+ self.assert_compile(x, "SELECT foo.this_is_the_primarykey_column, foo.this_is_the_data_column FROM "
+ "(SELECT some_large_named_table.this_is_the_primarykey_column AS this_1, some_large_named_table.this_is_the_data_column "
+ "AS this_2 FROM some_large_named_table WHERE some_large_named_table.this_is_the_primarykey_column = :this_1) AS foo", dialect=compile_dialect)
+
+ compile_dialect = default.DefaultDialect(label_length=4)
+ self.assert_compile(x, "SELECT foo.this_is_the_primarykey_column, foo.this_is_the_data_column FROM "
+ "(SELECT some_large_named_table.this_is_the_primarykey_column AS _1, some_large_named_table.this_is_the_data_column AS _2 "
+ "FROM some_large_named_table WHERE some_large_named_table.this_is_the_primarykey_column = :_1) AS foo", dialect=compile_dialect)
+
+ q = table1.select(table1.c.this_is_the_primarykey_column == 4).alias()
+ x = select([q], use_labels=True)
+
+ compile_dialect = default.DefaultDialect(label_length=10)
+ self.assert_compile(x, "SELECT anon_1.this_is_the_primarykey_column AS anon_1, anon_1.this_is_the_data_column AS anon_2 FROM "
+ "(SELECT some_large_named_table.this_is_the_primarykey_column AS this_3, some_large_named_table.this_is_the_data_column AS this_4 "
+ "FROM some_large_named_table WHERE some_large_named_table.this_is_the_primarykey_column = :this_1) AS anon_1", dialect=compile_dialect)
+
+ compile_dialect = default.DefaultDialect(label_length=4)
+ self.assert_compile(x, "SELECT anon_1.this_is_the_primarykey_column AS _1, anon_1.this_is_the_data_column AS _2 FROM "
+ "(SELECT some_large_named_table.this_is_the_primarykey_column AS _3, some_large_named_table.this_is_the_data_column AS _4 "
+ "FROM some_large_named_table WHERE some_large_named_table.this_is_the_primarykey_column = :_1) AS anon_1", dialect=compile_dialect)
+
+
if __name__ == '__main__':
testenv.main()