@defer.inlineCallbacks
    def test_Timeout_and_Deadline(self):
        yield self.named_conn.db.coll.insert({'x': 42}, safe=True, timeout=10)
        yield self.named_conn.db.coll.insert({'x': 42}, safe=True, deadline=time()+10)

        d_insert = self.named_conn.db.coll.insert({'x': 42}, safe=True, deadline=10-time())
        yield self.assertFailure(d_insert, TimeExceeded)

        d_insert = self.named_conn.db.coll.insert({'x': 42}, safe=True, timeout=-10)
        yield self.assertFailure(d_insert, TimeExceeded)

        def patch_deadline(_):
            check_deadline(time()-2)

        with patch('txmongo.collection.check_deadline', side_effect=patch_deadline):
            d_insert = self.named_conn.db.coll.find_one(
                {'x': 42}, deadline=time()+2)
            yield self.assertFailure(d_insert, TimeExceeded)
dataset/ETHPy150Open twisted/txmongo/tests/test_connection.py/TestMongoConnection.test_Timeout_and_Deadline/swapped operands of `-`