# Path: scalymongo/cursor.py
# class Cursor(object):
#     """Wrapper for :class:`pymongo.cursor.Cursor` objects.
# 
#     This class is a thin wrapper which takes results returned by the underlying
#     cursor and wraps them in the appropriate
#     :class:`~scalymongo.document.Document` subclass.
# 
#     """
# 
#     def __init__(self, wrapped_cursor, document_type):
#         self.__wrapped_cursor = wrapped_cursor
#         self.__document_type = document_type
# 
#     def __getitem__(self, index):
#         """Get the item(s) at `index`.
# 
#         :param index: may also be a slice.
#         """
#         returned = self.__wrapped_cursor[index]
#         # If the index is a slice then the result is a new cursor with the skip
#         # and limit already applied.
#         if isinstance(index, slice):
#             return Cursor(returned, self.__document_type)
#         return self.__document_type(returned)
# 
#     def next(self):
#         """Return the next document for this cursor."""
#         return self.__document_type(self.__wrapped_cursor.next())
# 
#     def __iter__(self):
#         return self
# 
#     # Wrap all methods that return a pymongo.cursor.Cursor.
#     batch_size = _make_cursor_wrapper_method('batch_size')
#     clone = _make_cursor_wrapper_method('clone')
#     hint = _make_cursor_wrapper_method('hint')
#     limit = _make_cursor_wrapper_method('limit')
#     max_scan = _make_cursor_wrapper_method('max_scan')
#     rewind = _make_cursor_wrapper_method('rewind')
#     skip = _make_cursor_wrapper_method('skip')
#     sort = _make_cursor_wrapper_method('sort')
#     where = _make_cursor_wrapper_method('where')
# 
#     def __getattr__(self, attr):
#         """All other methods and properties are those of the wrapped cursor."""
#         return getattr(self.__wrapped_cursor, attr)


from deterministic_dingus import DingusWhitelistTestCase, Dingus, DeterministicDingus
from scalymongo.cursor import Cursor
import scalymongo.cursor as mod
    def setup(self):
        BaseCursorTestCase.setup(self)

        self.returned = self.cursor.next()

    def should_return_wrapped_document(self):
        assert self.returned is self.document_type(self.wrapped_cursor.next())


####
##
## Cursor.*
##
####

class BaseWrappedMethod(BaseCursorTestCase):

    module_mocks = ['Cursor']
    additional_mocks = ['arg1', 'arg2', 'kwarg1', 'kwarg2']

    def setup(self):
        BaseCursorTestCase.setup(self)
        self.module.Cursor = DeterministicDingus('Cursor')
        self.method = getattr(self.cursor, self.method_name)
        self.wrapped_method = getattr(self.wrapped_cursor, self.method_name)

        self.returned = self.method(
            self.arg1, self.arg2, kwarg1=self.kwarg1, kwarg2=self.kwarg2)

    def should_return_wrapped_cursor(self):

# Path: scalymongo/cursor.py
# class Cursor(object):
#     """Wrapper for :class:`pymongo.cursor.Cursor` objects.
# 
#     This class is a thin wrapper which takes results returned by the underlying
#     cursor and wraps them in the appropriate
#     :class:`~scalymongo.document.Document` subclass.
# 
#     """
# 
#     def __init__(self, wrapped_cursor, document_type):
#         self.__wrapped_cursor = wrapped_cursor
#         self.__document_type = document_type
# 
#     def __getitem__(self, index):
#         """Get the item(s) at `index`.
# 
#         :param index: may also be a slice.
#         """
#         returned = self.__wrapped_cursor[index]
#         # If the index is a slice then the result is a new cursor with the skip
#         # and limit already applied.
#         if isinstance(index, slice):
#             return Cursor(returned, self.__document_type)
#         return self.__document_type(returned)
# 
#     def next(self):
#         """Return the next document for this cursor."""
#         return self.__document_type(self.__wrapped_cursor.next())
# 
#     def __iter__(self):
#         return self
# 
#     # Wrap all methods that return a pymongo.cursor.Cursor.
#     batch_size = _make_cursor_wrapper_method('batch_size')
#     clone = _make_cursor_wrapper_method('clone')
#     hint = _make_cursor_wrapper_method('hint')
#     limit = _make_cursor_wrapper_method('limit')
#     max_scan = _make_cursor_wrapper_method('max_scan')
#     rewind = _make_cursor_wrapper_method('rewind')
#     skip = _make_cursor_wrapper_method('skip')
#     sort = _make_cursor_wrapper_method('sort')
#     where = _make_cursor_wrapper_method('where')
# 
#     def __getattr__(self, attr):
#         """All other methods and properties are those of the wrapped cursor."""
#         return getattr(self.__wrapped_cursor, attr)


# Path: tests/unit/test_cursor.py
from deterministic_dingus import DingusWhitelistTestCase, Dingus, DeterministicDingus
from scalymongo.cursor import Cursor
import scalymongo.cursor as mod

    def setup(self):
        BaseCursorTestCase.setup(self)

        self.returned = self.cursor.next()

    def should_return_wrapped_document(self):
        assert self.returned is self.document_type(self.wrapped_cursor.next())


####
##
## Cursor.*
##
####

class BaseWrappedMethod(BaseCursorTestCase):

    module_mocks = ['Cursor']
    additional_mocks = ['arg1', 'arg2', 'kwarg1', 'kwarg2']

    def setup(self):
        BaseCursorTestCase.setup(self)
        self.module.Cursor = DeterministicDingus('Cursor')
        self.method = getattr(self.cursor, self.method_name)
        self.wrapped_method = getattr(self.wrapped_cursor, self.method_name)

        self.returned = self.method(
            self.arg1, self.arg2, kwarg1=self.kwarg1, kwarg2=self.kwarg2)

    def should_return_wrapped_cursor(self):

        assert self.returned is self.module.Cursor(