def test_pointer_query(): foo = Object.create('Foo') bar = Object.create('Bar') bar.save() foo.set('bar', bar) foo.save() q = Query('Foo').equal_to('bar', bar) assert len(q.find()) == 1 inner_query = leancloud.Query('Post') inner_query.exists("image") query = leancloud.Query('Comment') query.matches_query("post", inner_query) assert query.dump() == { 'where': { 'post': { '$inQuery': { 'className': 'Post', 'where': { 'image': { '$exists': True } } } } } }
def test_batch(): # type: () -> None foo = Object.create('Foo') bar = Object.create('Bar') bar.set('baz', 'baz') foo.set('bar', bar) bar.save() foo.save()
def test_pointer_query(): # type: () -> None foo = Object.create("Foo") bar = Object.create("Bar") bar.save() foo.set("bar", bar) foo.save() q = Query("Foo").equal_to("bar", bar) assert len(q.find()) == 1 inner_query = leancloud.Query("Post") inner_query.exists("image") query = leancloud.Query("Comment") query.matches_query("post", inner_query) assert query.dump() == { "where": { "post": { "$inQuery": { "className": "Post", "where": { "image": { "$exists": True } } } } } }
def test_batch(): foo = Object.create('Foo') bar = Object.create('Bar') bar.set('baz', 'baz') foo.set('bar', bar) bar.save() foo.save()
def test_batch(): foo = Object.create("Foo") bar = Object.create("Bar") bar.set("baz", "baz") foo.set("bar", bar) bar.save() foo.save()
def test_batch(): # type: () -> None foo = Object.create("Foo") bar = Object.create("Bar") bar.set("baz", "baz") foo.set("bar", bar) bar.save() foo.save()
def test_pointer_query(): foo = Object.create('Foo') bar = Object.create('Bar') bar.save() foo.set('bar', bar) foo.save() q = Query('Foo').equal_to('bar', bar) assert len(q.find()) == 1
def test_pointer_query(): # type: () -> None foo = Object.create('Foo') bar = Object.create('Bar') bar.save() foo.set('bar', bar) foo.save() q = Query('Foo').equal_to('bar', bar) assert len(q.find()) == 1 inner_query = leancloud.Query('Post') inner_query.exists("image") query = leancloud.Query('Comment') query.matches_query("post", inner_query) assert query.dump() == {'where': {'post': {'$inQuery': {'className': 'Post', 'where': {'image': {'$exists': True}}}}}}
def test_pointer_query(): foo = Object.create("Foo") bar = Object.create("Bar") bar.save() foo.set("bar", bar) foo.save() q = Query("Foo").equal_to("bar", bar) assert len(q.find()) == 1 inner_query = leancloud.Query("Post") inner_query.exists("image") query = leancloud.Query("Comment") query.matches_query("post", inner_query) assert query.dump() == { "where": {"post": {"$inQuery": {"className": "Post", "where": {"image": {"$exists": True}}}}} }
def create_followee_query(cls, user_id): if not user_id or not isinstance(user_id, basestring): raise TypeError('invalid user_id: {}'.format(user_id)) query = FriendshipQuery('_Followee') query.equal_to('user', Object.create('_User', id=user_id)) return query
def create_followee_query(cls, user_id): if not user_id or not isinstance(user_id, basestring): raise TypeError('invalid user_id: {0}'.format(user_id)) query = FriendshipQuery('_Followee') query.equal_to('user', Object.create('_User', id=user_id)) return query