~jbaker/storm/nose_plugin

« back to all changes in this revision

Viewing changes to tests/databases/base.py

  • Committer: Jamu Kakar
  • Date: 2009-11-24 18:34:34 UTC
  • mfrom: (340 storm.trunk)
  • mto: This revision was merged to the branch mainline in revision 341.
  • Revision ID: jkakar@kakar.ca-20091124183434-ambkvw9tp2byvjnc
- Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
395
395
            "UPDATE test SET title='whatever'")
396
396
        self.assertEquals(result.rowcount, 2)
397
397
 
 
398
    def test_expr_startswith(self):
 
399
        self.connection.execute("INSERT INTO test VALUES (30, '!!_%blah')")
 
400
        self.connection.execute("INSERT INTO test VALUES (40, '!!blah')")
 
401
        id = Column("id", SQLToken("test"))
 
402
        title = Column("title", SQLToken("test"))
 
403
        expr = Select(id, title.startswith(u"!!_%"))
 
404
        result = list(self.connection.execute(expr))
 
405
        self.assertEquals(result, [(30,)])
 
406
 
 
407
    def test_expr_endswith(self):
 
408
        self.connection.execute("INSERT INTO test VALUES (30, 'blah_%!!')")
 
409
        self.connection.execute("INSERT INTO test VALUES (40, 'blah!!')")
 
410
        id = Column("id", SQLToken("test"))
 
411
        title = Column("title", SQLToken("test"))
 
412
        expr = Select(id, title.endswith(u"_%!!"))
 
413
        result = list(self.connection.execute(expr))
 
414
        self.assertEquals(result, [(30,)])
 
415
 
 
416
    def test_expr_contains_string(self):
 
417
        self.connection.execute("INSERT INTO test VALUES (30, 'blah_%!!x')")
 
418
        self.connection.execute("INSERT INTO test VALUES (40, 'blah!!x')")
 
419
        id = Column("id", SQLToken("test"))
 
420
        title = Column("title", SQLToken("test"))
 
421
        expr = Select(id, title.contains_string(u"_%!!"))
 
422
        result = list(self.connection.execute(expr))
 
423
        self.assertEquals(result, [(30,)])
 
424
 
398
425
 
399
426
class UnsupportedDatabaseTest(object):
400
427