~free.ekanayaka/storm/any-expr

« back to all changes in this revision

Viewing changes to tests/databases/base.py

Merge reference-invalidated-state [r=jamesh,jkakar] [f=435962]

Check for invalidated state when returning the remote object of a relation:
it fixes a bug if the local key of the Reference is the primary key.

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