diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 16:03:00 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 16:03:00 -0400 |
| commit | 87bbba32bc54fa0253e9c81663df669dc355f5da (patch) | |
| tree | b0b59e889ec323a5f0b4bb58de752facb7dcd38e /test | |
| parent | a66861031a85063c9de8874559815f7ee0bab998 (diff) | |
| download | sqlalchemy-87bbba32bc54fa0253e9c81663df669dc355f5da.tar.gz | |
- [feature] The behavior of column targeting
in result sets is now case sensitive by
default. SQLAlchemy for many years would
run a case-insensitive conversion on these values,
probably to alleviate early case sensitivity
issues with dialects like Oracle and
Firebird. These issues have been more cleanly
solved in more modern versions so the performance
hit of calling lower() on identifiers is removed.
The case insensitive comparisons can be re-enabled
by setting "case_insensitive=False" on
create_engine(). [ticket:2423]
Diffstat (limited to 'test')
| -rw-r--r-- | test/aaa_profiling/test_resultset.py | 8 | ||||
| -rw-r--r-- | test/aaa_profiling/test_zoomark.py | 4 | ||||
| -rw-r--r-- | test/sql/test_query.py | 32 |
3 files changed, 34 insertions, 10 deletions
diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py index 632f67c6a..0fc85ca03 100644 --- a/test/aaa_profiling/test_resultset.py +++ b/test/aaa_profiling/test_resultset.py @@ -37,8 +37,8 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): '2.4': 13214, '2.6':14416, '2.7':14416, - '2.6+cextension': 365, - '2.7+cextension':365}) + '2.6+cextension': 336, + '2.7+cextension':336}) def test_string(self): [tuple(row) for row in t.select().execute().fetchall()] @@ -47,8 +47,8 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults): @profiling.function_call_count(versions={ '2.7':14396, '2.6':14396, - '2.6+cextension': 365, - '2.7+cextension':365}) + '2.6+cextension': 336, + '2.7+cextension':336}) def test_unicode(self): [tuple(row) for row in t2.select().execute().fetchall()] diff --git a/test/aaa_profiling/test_zoomark.py b/test/aaa_profiling/test_zoomark.py index a0336662d..d4c66336c 100644 --- a/test/aaa_profiling/test_zoomark.py +++ b/test/aaa_profiling/test_zoomark.py @@ -377,8 +377,8 @@ class ZooMarkTest(fixtures.TestBase): def test_profile_2_insert(self): self.test_baseline_2_insert() - @profiling.function_call_count(3340, {'2.4': 2158, '2.7':3541, - '2.7+cextension':3317, '2.6':3564}) + @profiling.function_call_count(3340, {'2.7':3333, + '2.7+cextension':3317, '2.6':3333}) def test_profile_3_properties(self): self.test_baseline_3_properties() diff --git a/test/sql/test_query.py b/test/sql/test_query.py index f315d6621..29a6ed355 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -852,9 +852,7 @@ class QueryTest(fixtures.TestBase): result.fetchone ) - def test_result_case_sensitivity(self): - """test name normalization for result sets.""" - + def test_row_case_sensitive(self): row = testing.db.execute( select([ literal_column("1").label("case_insensitive"), @@ -862,7 +860,33 @@ class QueryTest(fixtures.TestBase): ]) ).first() - assert row.keys() == ["case_insensitive", "CaseSensitive"] + eq_(row.keys(), ["case_insensitive", "CaseSensitive"]) + eq_(row["case_insensitive"], 1) + eq_(row["CaseSensitive"], 2) + + assert_raises( + KeyError, + lambda: row["Case_insensitive"] + ) + assert_raises( + KeyError, + lambda: row["casesensitive"] + ) + + def test_row_case_insensitive(self): + ins_db = engines.testing_engine(options={"case_sensitive":False}) + row = ins_db.execute( + select([ + literal_column("1").label("case_insensitive"), + literal_column("2").label("CaseSensitive") + ]) + ).first() + + eq_(row.keys(), ["case_insensitive", "CaseSensitive"]) + eq_(row["case_insensitive"], 1) + eq_(row["CaseSensitive"], 2) + eq_(row["Case_insensitive"],1) + eq_(row["casesensitive"],2) def test_row_as_args(self): |
