From 5c4cb743e43005b3bd0f7c462504f82c91c55058 Mon Sep 17 00:00:00 2001 From: Franco Masotti Date: Mon, 20 Nov 2023 23:49:31 +0100 Subject: [PATCH] Merge code - Merge conflict-causing code from branch '9.x'. This does not affect functionality of the 'dev' branch --- Makefile | 10 ++++- md_toc/tests/tests.py | 100 ------------------------------------------ 2 files changed, 8 insertions(+), 102 deletions(-) diff --git a/Makefile b/Makefile index 8a504a0..d470f8e 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,11 @@ test: && tox run-parallel \ && deactivate +fuzzer: + $(VENV_CMD) \ + && tox run -e fuzzer \ + && deactivate + pre-commit: $(VENV_CMD) \ && pre-commit run --all \ @@ -119,11 +124,12 @@ upload: clean: rm -rf build dist *.egg-info tests/benchmark-results # Remove all markdown files except the readmes. - find -regex ".*\.[mM][dD]" \ + find -regex "\(.*/crash-[a-f0-9]+\|.*\.[mM][dD]\)$$" \ ! -name 'README.md' \ ! -name 'CONTRIBUTING.md' \ ! -name 'SECURITY.md' \ - -type f -exec rm -f {} + + ! -path './.venv/*' \ + ! -path './.git/*' -type f -exec rm -f {} + $(VENV_CMD) \ && $(MAKE) -C docs clean \ && deactivate diff --git a/md_toc/tests/tests.py b/md_toc/tests/tests.py index dbe86cf..303d170 100644 --- a/md_toc/tests/tests.py +++ b/md_toc/tests/tests.py @@ -4424,106 +4424,6 @@ def test_is_closing_code_fence(self): api.is_closing_code_fence(TILDE3 + T1, TILDE3, 'cmark'), ) self.assertFalse(api.is_closing_code_fence(TILDE3 + T4 + S4, TILDE3), ) - @unittest.skip('empty test') - def test_init_indentation_status_list(self): - r"""Test building of the indentation data structure. - - There is no need to test this since it is a trivial function. - """ - - def _test_helper_toc_renders_as_coherent_list( - self, - header_type_curr, - header_type_first, - indentation_list, - expected_indentation_list, - expected_result, - ): - result = api.toc_renders_as_coherent_list( - header_type_curr, - header_type_first, - indentation_list, - ) - self.assertEqual(result, expected_result) - self.assertEqual(indentation_list, expected_indentation_list) - - def test_toc_renders_as_coherent_list(self): - r"""Test if the TOC renders as a list the user intended.""" - # github and redcarpet. - - # 1. header_type_first = 1; header_type_curr = 1. - expected_indentation_list = [True, False, False, False, False, False] - self._test_helper_toc_renders_as_coherent_list( - BASE_CASE_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR, - BASE_CASE_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST, - api.init_indentation_status_list('github'), - expected_indentation_list, - True, - ) - - # 2. header_type_first = 1; header_type_curr = generic > 1. - indentation_list = api.init_indentation_status_list('github') - for i in range(0, GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR - 1): - indentation_list[i] = True - expected_indentation_list = [True, True, True, True, False, False] - self._test_helper_toc_renders_as_coherent_list( - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR, - BASE_CASE_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST, - indentation_list, - expected_indentation_list, - True, - ) - - # 3. header_type_first = generic > 1; header_type_curr = 1. - indentation_list = api.init_indentation_status_list('github') - expected_indentation_list = [True, False, False, False, False, False] - self._test_helper_toc_renders_as_coherent_list( - BASE_CASE_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR, - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST, - indentation_list, - expected_indentation_list, - False, - ) - - # 4. header_type_first = generic > 1; header_type_curr = generic > 1; header_type_curr > header_type_first. - indentation_list = api.init_indentation_status_list('github') - indentation_list[GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST - - 1] = True - expected_indentation_list = [False, False, False, True, True, False] - self._test_helper_toc_renders_as_coherent_list( - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR_BIS, - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST, - indentation_list, - expected_indentation_list, - True, - ) - - # 4. header_type_first = generic > 1; header_type_curr = generic > 1; header_type_curr == header_type_first. - indentation_list = api.init_indentation_status_list('github') - indentation_list[GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR - - 1] = True - expected_indentation_list = [False, False, False, True, False, False] - self._test_helper_toc_renders_as_coherent_list( - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR, - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR, - indentation_list, - expected_indentation_list, - True, - ) - - # 5. header_type_first = generic > 1; header_type_curr = generic > 1; header_type_curr < header_type_first. - indentation_list = api.init_indentation_status_list('github') - indentation_list[GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR_BIS - - 1] = True - expected_indentation_list = [False, False, False, True, False, False] - self._test_helper_toc_renders_as_coherent_list( - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_FIRST, - GENERIC_CMARK_RENDERS_AS_LIST_HEADER_TYPE_CURR_BIS, - indentation_list, - expected_indentation_list, - False, - ) - if __name__ == '__main__': unittest.main()