~free.ekanayaka/storm/any-expr

« back to all changes in this revision

Viewing changes to tests/databases/base.py

  • Committer: Jamu Kakar
  • Date: 2009-11-24 19:10:43 UTC
  • mfrom: (327.2.4 default-c-extensions)
  • Revision ID: jkakar@kakar.ca-20091124191043-z45n74ff1ebnh4w3
Merged default-c-extensions [r=jamesh,therve] [f=410592]

Storm's C extensions are enabled by default.  They can be disabled
by defining the STORM_CEXTENSIONS environment variable to '0'.

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