summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-01-10 02:37:39 +0000
committerJason Kirtland <jek@discorporate.us>2008-01-10 02:37:39 +0000
commitbf36c648f2ef304f77cbde803453b0075ca6dcde (patch)
tree058ac03ea0818588629e35cf333274d8cd4cb995 /test/sql
parent84576e3258ea05b044f90463e8a59541661d5931 (diff)
downloadsqlalchemy-bf36c648f2ef304f77cbde803453b0075ca6dcde.tar.gz
Reworked r4042- undeclared deprecation warnings are now *fatal* to tests. No surprises.
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/defaults.py2
-rw-r--r--test/sql/labels.py2
-rw-r--r--test/sql/query.py2
-rw-r--r--test/sql/select.py9
4 files changed, 7 insertions, 8 deletions
diff --git a/test/sql/defaults.py b/test/sql/defaults.py
index a67eea894..98b379995 100644
--- a/test/sql/defaults.py
+++ b/test/sql/defaults.py
@@ -397,7 +397,7 @@ class SequenceTest(PersistTest):
)
sometable = Table( 'Manager', metadata,
Column('obj_id', Integer, Sequence('obj_id_seq'), ),
- Column('name', String, ),
+ Column('name', String(128)),
Column('id', Integer, Sequence('Manager_id_seq', optional=True),
primary_key=True),
)
diff --git a/test/sql/labels.py b/test/sql/labels.py
index 6f94956dc..90323dc73 100644
--- a/test/sql/labels.py
+++ b/test/sql/labels.py
@@ -15,7 +15,7 @@ class LabelTypeTest(PersistTest):
Column('col1', Integer),
Column('col2', Float))
assert isinstance(t.c.col1.label('hi').type, Integer)
- assert isinstance(select([t.c.col2], scalar=True).label('lala').type, Float)
+ assert isinstance(select([t.c.col2]).as_scalar().label('lala').type, Float)
class LongLabelsTest(SQLCompileTest):
def setUpAll(self):
diff --git a/test/sql/query.py b/test/sql/query.py
index f1aba961d..2d5076b9a 100644
--- a/test/sql/query.py
+++ b/test/sql/query.py
@@ -275,7 +275,7 @@ class QueryTest(PersistTest):
datetable.create()
try:
datetable.insert().execute(id=1, today=datetime.datetime(2006, 5, 12, 12, 0, 0))
- s = select([datetable.alias('x').c.today], scalar=True)
+ s = select([datetable.alias('x').c.today]).as_scalar()
s2 = select([datetable.c.id, s.label('somelabel')])
#print s2.c.somelabel.type
assert isinstance(s2.execute().fetchone()['somelabel'], datetime.datetime)
diff --git a/test/sql/select.py b/test/sql/select.py
index c98046eb8..70bf704ce 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -243,7 +243,7 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
"SELECT mytable.myid, mytable.name, mytable.description FROM mytable ORDER BY (SELECT myothertable.otherid FROM myothertable WHERE mytable.myid = myothertable.otherid) DESC"
)
-
+ @testing.uses_deprecated('scalar option')
def test_scalar_select(self):
try:
s = select([table1.c.myid, table1.c.name]).as_scalar()
@@ -944,6 +944,7 @@ EXISTS (select yay from foo where boo = lar)",
dialect=postgres.dialect()
)
+ @testing.uses_deprecated('//get_params')
def testbindparam(self):
for (
stmt,
@@ -1015,13 +1016,11 @@ 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())
- testing.squelch_deprecation(positional.get_params)
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)))
pp = positional.get_params(**test_param_dict)
assert [pp[k] for k in positional.positiontup] == expected_test_params_list
- testing.enable_deprecation(positional.get_params)
# check that params() doesnt modify original statement
s = select([table1], or_(table1.c.myid==bindparam('myid'), table2.c.otherid==bindparam('myotherid')))
@@ -1038,9 +1037,8 @@ EXISTS (select yay from foo where boo = lar)",
"SELECT mytable.myid, mytable.name, mytable.description, (SELECT mytable.myid FROM mytable WHERE mytable.myid = "\
":mytable_myid_1) AS anon_1 FROM mytable WHERE mytable.myid = (SELECT mytable.myid FROM mytable WHERE mytable.myid = :mytable_myid_1)")
positional = s2.compile(dialect=sqlite.dialect())
- testing.squelch_deprecation(positional.get_params)
+
pp = positional.get_params()
- testing.enable_deprecation(positional.get_params)
assert [pp[k] for k in positional.positiontup] == [12, 12]
# check that conflicts with "unique" params are caught
@@ -1157,6 +1155,7 @@ UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE
self.assert_compile(select([table1], table1.c.myid.in_([])),
"SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE (CASE WHEN (mytable.myid IS NULL) THEN NULL ELSE 0 END = 1)")
+ @testing.uses_deprecated('passing in_')
def test_in_deprecated_api(self):
self.assert_compile(select([table1], table1.c.myid.in_('abc')),
"SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid IN (:mytable_myid_1)")