tests.test_blocks moduleΒΆ

Test the dependency-light self-updating block toolkit.

tests.test_blocks.DEPRECATED_BLOCKS_NAMES = ('FenceSpan', 'fence_spans', 'iter_markdown_files', 'marker_res', 'region_markers', 'replace_region', 'rewrite_fenced_regions', 'skip_region', 'split_options', 'update_blocks')ΒΆ

Public names of the 9.x click_extra.blocks module that 10.x still defines.

tests.test_blocks.REGION = 'intro\n\n<!-- t -->\nOLD\n<!-- t-end -->\n\nend\n'ΒΆ

A minimal document carrying a single <!-- t --> / <!-- t-end --> region.

tests.test_blocks.test_blocks_module_needs_no_sphinx_extra()[source]ΒΆ

click_extra.markdown.blocks imports without pulling in the sphinx extra.

The whole point of hosting the toolkit outside click_extra.sphinx is that a release pipeline or standalone script can reuse it without installing Sphinx or docutils. Assert it in a fresh interpreter so an already-loaded Sphinx (from another test) cannot mask a regression.

tests.test_blocks.test_deprecated_blocks_alias_serves_9x_name(name)[source]ΒΆ

click_extra.blocks serves each name it kept from 9.x, with a warning.

tests.test_blocks.test_deprecated_blocks_alias_star_import()[source]ΒΆ

A star import binds each name the alias serves, with one warning per name.

tests.test_blocks.test_deprecated_blocks_alias_serves_no_other_name(name)[source]ΒΆ

A name the alias does not serve stays missing, and sets off no warning.

tests.test_blocks.test_marker_res_grammar()[source]ΒΆ

The open marker is bare; the close marker carries the -end suffix.

tests.test_blocks.test_replace_region(content, pad, expected)[source]ΒΆ

replace_region swaps the marked body under both padding modes.

tests.test_blocks.QUOTED_REGION = '<!-- t -->\n\nOLD\n\n```markdown\n<!-- t-end -->\n```\n\n<!-- t-end -->\n'ΒΆ

A region whose body quotes its own closing marker inside a code fence.

tests.test_blocks.test_skip_region_steps_over_a_quoted_end_marker()[source]ΒΆ

A closing marker quoted in a fence of the region does not end it.

tests.test_blocks.test_rewrite_fenced_regions_keeps_a_quoted_end_marker()[source]ΒΆ

A region holding a fence that quotes its closing marker round-trips.

A search for the closing marker that does not step over fences ends the region on the quoted one, and each refresh then leaves the rest of the stale region below the new one.

tests.test_blocks.test_replace_region_ignores_markers_quoted_in_fences()[source]ΒΆ

Markers shown in a code example are not the live region.

tests.test_blocks.test_replace_region_missing_markers_is_noop()[source]ΒΆ

A document without the markers is returned untouched.

tests.test_blocks.test_fence_spans_treats_nested_fences_as_opaque()[source]ΒΆ

A fence nested inside a longer fence never starts a span of its own.

tests.test_blocks.test_fence_spans_close(lines, close, end)[source]ΒΆ

A fence closes on the first bare backtick run that is long enough.

tests.test_blocks.test_fence_span_body(lines, body)[source]ΒΆ

The body of a span is everything between its fence lines.

tests.test_blocks.test_fence_spans_chars(chars, spans)[source]ΒΆ

Colon fences are fences only on request, and close on colons alone.

tests.test_blocks.test_walk_fences_steps_over_fences()[source]ΒΆ

Lines outside fences come one by one, each fence as one unit.

tests.test_blocks.test_rewrite_fences_keeps_what_visit_leaves()[source]ΒΆ

A step visit passes on is copied, an unterminated fence included.

tests.test_blocks.test_split_options(lines, options, content)[source]ΒΆ

Leading option lines are split from the content of a fence body.

tests.test_blocks.test_update_blocks_writes_and_check_mode(tmp_path)[source]ΒΆ

update_blocks rewrites changed files, and check reports without writing.

tests.test_blocks.test_iter_markdown_files_recurses_directories(tmp_path)[source]ΒΆ

Directories are recursed for *.md; explicit files pass through as-is.