~free.ekanayaka/storm/any-expr

« back to all changes in this revision

Viewing changes to tests/store/base.py

  • Committer: James Henstridge
  • Date: 2009-04-24 03:35:36 UTC
  • mto: This revision was merged to the branch mainline in revision 320.
  • Revision ID: james@jamesh.id.au-20090424033536-ad4mmpycqyzau85c
Add back tests from Thomas Herve's attempt to fix this bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
841
841
        count = self.store.find(Link).count(Link.foo_id, distinct=True)
842
842
        self.assertEquals(count, 3)
843
843
 
 
844
    def test_find_limit_count(self):
 
845
        result = self.store.find(Link.foo_id)
 
846
        result.config(limit=2)
 
847
        count = result.count()
 
848
        self.assertEquals(count, 2)
 
849
 
 
850
    def test_find_offset_count(self):
 
851
        result = self.store.find(Link.foo_id)
 
852
        result.config(offset=3)
 
853
        count = result.count()
 
854
        self.assertEquals(count, 3)
 
855
 
 
856
    def test_find_sliced_count(self):
 
857
        result = self.store.find(Link.foo_id)
 
858
        count = result[2:4].count()
 
859
        self.assertEquals(count, 2)
 
860
 
 
861
    def test_find_distinct_count(self):
 
862
        result = self.store.find(Link.foo_id)
 
863
        result.config(distinct=True)
 
864
        count = result.count()
 
865
        self.assertEquals(count, 3)
 
866
 
 
867
    def test_find_distinct_count_multiple_columns(self):
 
868
        result = self.store.find((Link.foo_id, Link.bar_id))
 
869
        result.config(distinct=True)
 
870
        count = result.count()
 
871
        self.assertEquals(count, 6)
 
872
 
 
873
    def test_find_count_column_with_implicit_distinct(self):
 
874
        result = self.store.find(Link)
 
875
        result.config(distinct=True)
 
876
        count = result.count(Link.foo_id)
 
877
        self.assertEquals(count, 3)
 
878
 
 
879
    def test_find_count_multiple_columns_with_implicit_distinct(self):
 
880
        result = self.store.find(Link)
 
881
        result.config(distinct=True)
 
882
        count = result.count((Link.foo_id, Link.bar_id))
 
883
        self.assertEquals(count, 6)
 
884
 
844
885
    def test_find_max(self):
845
886
        self.assertEquals(self.store.find(Foo).max(Foo.id), 30)
846
887