# Path: scalymongo/errors.py
# class GlobalQueryException(Exception):
#     """Raised when a query will hit multiple shards.
# 
#     This exception is raised by default when doing a
#     :meth:`~scalymongo.document.Document.find`,
#     :meth:`~scalymongo.document.Document.remove` or any other type of query
#     when the query is likely to hit multiple shards.  This check is done in
#     order to warn developers of behavior that may not perform well at scale.
# 
#     """
#     pass
# 
# class ModifyFailedError(Exception):
#     """Raised when :meth:`~scalymongo.document.Document.modify` fails."""
#     pass


from deterministic_dingus import DeterministicDingus
from dingus import DingusTestCase, Dingus, exception_raiser
from nose.tools import assert_raises
from scalymongo.document import *
from scalymongo.errors import GlobalQueryException, ModifyFailedError
import scalymongo.document as mod
        self.query = Dingus('query')
        self.update = Dingus('update')
        self.kwargs = {'foo': Dingus('foo'), 'bar': Dingus('bar')}
        self.MyDoc.check_query_sharding = Dingus('check_query_sharding')
        self.MyDoc.validate = Dingus('validate')
        self.MyDoc.__init__ = Dingus('__init__', return_value=None)
        mod.is_update_modifier = Dingus('is_update_modifier')
        mod.validate_update_modifier = Dingus('validate_update_modifier')

    def teardown(self):
        reload(mod)

    def should_check_if_is_update_modifier(self):
        assert mod.is_update_modifier.calls('()', self.update)


class PropertyAllowGlobalIsFalse(object):

    def should_check_query_sharding(self):
        assert self.MyDoc.check_query_sharding.calls('()', self.query)


class PropertyAllowGlobalIsTrue(object):

    def should_not_check_query_sharding(self):
        assert not self.MyDoc.check_query_sharding.calls('()')


class PropertyFindAndModifySuceeds(object):


# Path: scalymongo/errors.py
# class GlobalQueryException(Exception):
#     """Raised when a query will hit multiple shards.
# 
#     This exception is raised by default when doing a
#     :meth:`~scalymongo.document.Document.find`,
#     :meth:`~scalymongo.document.Document.remove` or any other type of query
#     when the query is likely to hit multiple shards.  This check is done in
#     order to warn developers of behavior that may not perform well at scale.
# 
#     """
#     pass
# 
# class ModifyFailedError(Exception):
#     """Raised when :meth:`~scalymongo.document.Document.modify` fails."""
#     pass


# Path: tests/unit/test_document.py
from deterministic_dingus import DeterministicDingus
from dingus import DingusTestCase, Dingus, exception_raiser
from nose.tools import assert_raises
from scalymongo.document import *
from scalymongo.errors import GlobalQueryException, ModifyFailedError
import scalymongo.document as mod

        self.query = Dingus('query')
        self.update = Dingus('update')
        self.kwargs = {'foo': Dingus('foo'), 'bar': Dingus('bar')}
        self.MyDoc.check_query_sharding = Dingus('check_query_sharding')
        self.MyDoc.validate = Dingus('validate')
        self.MyDoc.__init__ = Dingus('__init__', return_value=None)
        mod.is_update_modifier = Dingus('is_update_modifier')
        mod.validate_update_modifier = Dingus('validate_update_modifier')

    def teardown(self):
        reload(mod)

    def should_check_if_is_update_modifier(self):
        assert mod.is_update_modifier.calls('()', self.update)


class PropertyAllowGlobalIsFalse(object):

    def should_check_query_sharding(self):
        assert self.MyDoc.check_query_sharding.calls('()', self.query)


class PropertyAllowGlobalIsTrue(object):

    def should_not_check_query_sharding(self):
        assert not self.MyDoc.check_query_sharding.calls('()')


class PropertyFindAndModifySuceeds(object):


    def should_run_findandmodify_command(self):