summaryrefslogtreecommitdiff
path: root/test/aaa_profiling/test_memusage.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-06-13 16:09:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-06-13 16:09:13 -0400
commit03e0f776beff157886d174284847868c8f2aed1d (patch)
tree6afc517e0ecb8a6cf11dfafc0d7ab5cb2b788e58 /test/aaa_profiling/test_memusage.py
parent7378611832a8b58ce040dab3ee0739209c4c8854 (diff)
downloadsqlalchemy-03e0f776beff157886d174284847868c8f2aed1d.tar.gz
- The warning emitted by the Unicode and String types
with convert_unicode=True no longer embeds the actual value passed. This so that the Python warning registry does not continue to grow in size, the warning is emitted once as per the warning filter settings, and large string values don't pollute the output. [ticket:1822]
Diffstat (limited to 'test/aaa_profiling/test_memusage.py')
-rw-r--r--test/aaa_profiling/test_memusage.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py
index 682411093..491a57fb0 100644
--- a/test/aaa_profiling/test_memusage.py
+++ b/test/aaa_profiling/test_memusage.py
@@ -7,7 +7,7 @@ from sqlalchemy.util import jython
import operator
from sqlalchemy.test import testing, engines
from sqlalchemy import MetaData, Integer, String, ForeignKey, \
- PickleType, create_engine
+ PickleType, create_engine, Unicode
from sqlalchemy.test.schema import Table, Column
import sqlalchemy as sa
from sqlalchemy.sql import column
@@ -252,6 +252,29 @@ class MemUsageTest(EnsureZeroed):
go()
finally:
metadata.drop_all()
+
+ def test_unicode_warnings(self):
+ metadata = MetaData(testing.db)
+ table1 = Table("mytable", metadata,
+ Column('col1', Integer, primary_key=True,
+ test_needs_autoincrement=True),
+ Column('col2', Unicode(30)))
+
+ metadata.create_all()
+
+ i = [1]
+ @testing.emits_warning()
+ @profile_memory
+ def go():
+ # execute with a non-unicode object.
+ # a warning is emitted, this warning shouldn't
+ # clog up memory.
+ testing.db.execute(table1.select().where(table1.c.col2=='foo%d' % i[0]))
+ i[0] += 1
+ try:
+ go()
+ finally:
+ metadata.drop_all()
def test_mapper_reset(self):
metadata = MetaData(testing.db)