# Path: artman/tasks/descriptor_set_tasks.py
# class PythonDocsConvertionTask(task_base.TaskBase):
# class EmptyDescriptorTask(task_base.EmptyTask):
#     def execute(self, descriptor_set):
# def _replace(comment, pattern, repl_fn):
# def _replace_proto_link(comment):
#     def _format(m):
# def _replace_relative_link(comment):
#     def _format(m):
# def _insert_spaces(comment):
#     def _format(m):
# def _add_space(comment):
#     def _format(m):
# def md2rst(comment):
# def get_descriptor_set_task(language):
# _DESC_TASK_DICT = {
#     'python': PythonDocsConvertionTask,
# }


import unittest
import pypandoc
import mock
import restructuredtext_lint
from artman.tasks import descriptor_set_tasks
from google.protobuf import descriptor_pb2 as desc
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import



class PythonDocsConversionTests(unittest.TestCase):
    @mock.patch.object(pypandoc, 'convert_text')
    def test_execute(self, convert_text):
        convert_text.return_value = ''
        descriptor_set = 'test/tasks/data/test_descriptor/descriptor_set'
        task = descriptor_set_tasks.PythonDocsConvertionTask()
        task.execute(descriptor_set)
        convert_text.assert_called()

    @unittest.expectedFailure
    def test_valid_rst(self):
        descriptor_set = 'test/tasks/data/test_descriptor/descriptor_set'
        task = descriptor_set_tasks.PythonDocsConvertionTask()
        updated_descriptor = task.execute(descriptor_set)

        desc_set = desc.FileDescriptorSet()
        with open(updated_descriptor, 'rb') as f:
            desc_set.ParseFromString(f.read())

        lint_errors = []
        comment_count = 0

# Path: artman/tasks/descriptor_set_tasks.py
# class PythonDocsConvertionTask(task_base.TaskBase):
# class EmptyDescriptorTask(task_base.EmptyTask):
#     def execute(self, descriptor_set):
# def _replace(comment, pattern, repl_fn):
# def _replace_proto_link(comment):
#     def _format(m):
# def _replace_relative_link(comment):
#     def _format(m):
# def _insert_spaces(comment):
#     def _format(m):
# def _add_space(comment):
#     def _format(m):
# def md2rst(comment):
# def get_descriptor_set_task(language):
# _DESC_TASK_DICT = {
#     'python': PythonDocsConvertionTask,
# }


# Path: test/tasks/test_descriptor.py
import unittest
import pypandoc
import mock
import restructuredtext_lint
from artman.tasks import descriptor_set_tasks
from google.protobuf import descriptor_pb2 as desc

# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import



class PythonDocsConversionTests(unittest.TestCase):
    @mock.patch.object(pypandoc, 'convert_text')
    def test_execute(self, convert_text):
        convert_text.return_value = ''
        descriptor_set = 'test/tasks/data/test_descriptor/descriptor_set'
        task = descriptor_set_tasks.PythonDocsConvertionTask()
        task.execute(descriptor_set)
        convert_text.assert_called()

    @unittest.expectedFailure
    def test_valid_rst(self):
        descriptor_set = 'test/tasks/data/test_descriptor/descriptor_set'
        task = descriptor_set_tasks.PythonDocsConvertionTask()
        updated_descriptor = task.execute(descriptor_set)

        desc_set = desc.FileDescriptorSet()
        with open(updated_descriptor, 'rb') as f:
            desc_set.ParseFromString(f.read())

        lint_errors = []
        comment_count = 0

        for comment in gather_comments_from_descriptor_set(desc_set):