# Path: dwitter/templatetags/insert_code_blocks.py
# @register.filter
# def insert_code_blocks(text):
#     result = re.sub(
#         r'`'                # start with `
#         r'(?P<code>.*?)'    # capture code block
#         r'(?<!\\)'          # not preceded by \
#         r'`',               # end with `
#         to_code_block,
#         text
#     )
#     return mark_safe(result)


from django.test import TestCase
from dwitter.templatetags.insert_code_blocks import insert_code_blocks


class DweetTestCase(TestCase):
    def test_insert_code_blocks_wraps_stuff_inside_backticks(self):
        self.assertEqual(
            '<code>a</code>',

# Path: dwitter/templatetags/insert_code_blocks.py
# @register.filter
# def insert_code_blocks(text):
#     result = re.sub(
#         r'`'                # start with `
#         r'(?P<code>.*?)'    # capture code block
#         r'(?<!\\)'          # not preceded by \
#         r'`',               # end with `
#         to_code_block,
#         text
#     )
#     return mark_safe(result)


# Path: dwitter/tests/templatetags/test_insert_code_blocks.py
from django.test import TestCase
from dwitter.templatetags.insert_code_blocks import insert_code_blocks



class DweetTestCase(TestCase):
    def test_insert_code_blocks_wraps_stuff_inside_backticks(self):
        self.assertEqual(
            '<code>a</code>',

            insert_code_blocks('`a`')