Skip to content

Preserve table display names on self assignment#537

Merged
frostming merged 1 commit into
python-poetry:masterfrom
gaoflow:fix-291-preserve-dotted-display-name
Jul 14, 2026
Merged

Preserve table display names on self assignment#537
frostming merged 1 commit into
python-poetry:masterfrom
gaoflow:fix-291-preserve-dotted-display-name

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #291.

Summary

  • avoid invalidating parsed table display names when a table is assigned back to its existing slot
  • add a regression test for preserving whitespace and quoting in dotted table headers after self-assignment

Verification

  • uv run --no-project --with pytest --with pyyaml python -m pytest tests/test_toml_document.py::test_replace_table_with_itself_preserves_display_name tests/test_toml_document.py::test_replace_with_table_of_nested tests/test_toml_document.py::test_nested_table_update_display_name -q
  • uv run --no-project --with pytest --with pyyaml python -m pytest -q
  • uv run --no-project --with ruff ruff check tomlkit/container.py tests/test_toml_document.py
  • uv run --no-project --with ruff ruff format --check tomlkit/container.py tests/test_toml_document.py
  • python -m compileall tomlkit/container.py tests/test_toml_document.py
  • git diff --check

@frostming

Copy link
Copy Markdown
Contributor

Please resolve conflict and add changelog

@gaoflow gaoflow force-pushed the fix-291-preserve-dotted-display-name branch from 139a9d3 to 3ffd6ae Compare July 13, 2026 08:21
@gaoflow

gaoflow commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Done — rebased onto master (the conflict was just two adjacent new test functions; kept both) and added a changelog entry under Fixed. The bug still reproduces on current master: doc[k] = doc[k] normalizes [keys .'a'.'c'] to [keys.a.'c'], and this restores exact header preservation. Full suite green.

@frostming frostming merged commit 4906936 into python-poetry:master Jul 14, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Difference in whitespace in dot notation disappears

2 participants