# 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
    ):

    def setup(self):
        BaseModify.setup(self)
        self.my_doc.modify(self.update)


class TestModifyWithExplicitQuerySpec(
    BaseModify,
    PropertyModifyWithExplicitQuerySpec,
    PropertyModifyUpdatesLocalCopy,
    ):

    def setup(self):
        BaseModify.setup(self)
        self.query = {'blarg': Dingus('blarg')}
        self.my_doc.modify(self.update, query=self.query)


class WhenFindAndModifyReturnsNone(
    BaseModify,
    ):

    def setup(self):
        BaseModify.setup(self)
        self.query = {'blarg': Dingus('blarg')}
        self.MyDoc.reload = Dingus('reload')
        self.MyDoc.find_and_modify.return_value = None

        assert_raises(

# 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

    ):

    def setup(self):
        BaseModify.setup(self)
        self.my_doc.modify(self.update)


class TestModifyWithExplicitQuerySpec(
    BaseModify,
    PropertyModifyWithExplicitQuerySpec,
    PropertyModifyUpdatesLocalCopy,
    ):

    def setup(self):
        BaseModify.setup(self)
        self.query = {'blarg': Dingus('blarg')}
        self.my_doc.modify(self.update, query=self.query)


class WhenFindAndModifyReturnsNone(
    BaseModify,
    ):

    def setup(self):
        BaseModify.setup(self)
        self.query = {'blarg': Dingus('blarg')}
        self.MyDoc.reload = Dingus('reload')
        self.MyDoc.find_and_modify.return_value = None

        assert_raises(

            ModifyFailedError,