コード例 #1
0
def test_skips():
    create_design_documents(overwrite=True)
    for i in xrange(20):
        Foo.create(str(i), field1=i)
    qs = Foo.get_objects('test', 'test')
    assert qs[10].field1 == 10
    assert [x.field1 for x in qs[10:]] == range(10, 20)
    assert [x.field1 for x in qs[8:15]] == range(8, 15)
コード例 #2
0
def test_iterator():
    create_design_documents(overwrite=True)
    for i in xrange(20):
        Foo.create(str(i), field1=i)
    qs = Foo.get_objects('test', 'test', {}, limit=5)
    assert range(20) == [x.field1 for x in qs]

    # test again to confirm the qs can be iterated twice
    assert range(20) == [x.field1 for x in qs]
コード例 #3
0
 def handle_noargs(self, **options):
     if not options['silentmode']:
         logging.getLogger('couchbase_engine').setLevel(logging.INFO)
     if options['debugmode']:
         logging.getLogger('couchbase_engine').setLevel(logging.DEBUG)
     create_design_documents(options['overwrite'])