How to use the cloudant.result.QueryResult function in cloudant

To help you get started, we’ve selected a few cloudant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudant / python-cloudant / tests / unit / query_result_tests.py View on Github external
def test_constructor_with_query_skip_limit(self):
        """
        Test instantiating a QueryResult when query callable already has
        skip and/or limit
        """
        query = Query(self.db, skip=10, limit=10)
        result = QueryResult(query)
        self.assertIsInstance(result, QueryResult)
        self.assertDictEqual(result.options, {'skip': 10, 'limit': 10})
        self.assertEqual(result._ref, query)
github cloudant / python-cloudant / tests / unit / query_result_tests.py View on Github external
def create_result(self, selector={'_id': {'$gt': 0}},
        fields=['_id', 'name', 'age'], **kwargs):
        if kwargs.get('q_parms', None):
            query = Query(self.db, **kwargs['q_parms'])
        else:
            query = Query(self.db)

        if kwargs.get('qr_parms', None):
            return QueryResult(query, selector=selector, fields=fields, **kwargs['qr_parms'])
        else:
            return QueryResult(query, selector=selector, fields=fields)
github cloudant / python-cloudant / tests / unit / query_tests.py View on Github external
def test_constructor_without_kwargs(self):
        """
        Test instantiating a Query without parameters
        """
        query = Query(self.db)
        self.assertIsInstance(query, Query)
        self.assertIsInstance(query.result, QueryResult)
        self.assertEqual(query, {})
github cloudant / python-cloudant / tests / unit / query_result_tests.py View on Github external
def test_constructor_with_options(self):
        """
        Test instantiating a QueryResult by passing in query parameters
        """
        query = Query(self.db)
        result = QueryResult(query, foo='bar', page_size=10)
        self.assertIsInstance(result, QueryResult)
        self.assertEqual(result.options, {'foo': 'bar'})
        self.assertEqual(result._ref, query)
        self.assertEqual(result._page_size, 10)
github cloudant / python-cloudant / tests / unit / query_tests.py View on Github external
def test_constructor_with_kwargs(self):
        """
        Test instantiating a Query by passing in query parameters
        """
        query = Query(self.db, foo={'bar': 'baz'})
        self.assertIsInstance(query, Query)
        self.assertIsInstance(query.result, QueryResult)
        self.assertEqual(query, {'foo': {'bar': 'baz'}})
github cloudant / python-cloudant / tests / unit / query_result_tests.py View on Github external
def create_result(self, selector={'_id': {'$gt': 0}},
        fields=['_id', 'name', 'age'], **kwargs):
        if kwargs.get('q_parms', None):
            query = Query(self.db, **kwargs['q_parms'])
        else:
            query = Query(self.db)

        if kwargs.get('qr_parms', None):
            return QueryResult(query, selector=selector, fields=fields, **kwargs['qr_parms'])
        else:
            return QueryResult(query, selector=selector, fields=fields)
github cloudant / python-cloudant / tests / unit / query_result_tests.py View on Github external
def test_constructor_without_options(self):
        """
        Test instantiating a Query without parameters
        """
        query = Query(self.db)
        result = QueryResult(query)
        self.assertIsInstance(result, QueryResult)
        self.assertEqual(result.options, {})
        self.assertEqual(result._ref, query)
        self.assertEqual(result._page_size, 100)