Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a final line-ending if multi-line input string #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gdiepen
Copy link

@gdiepen gdiepen commented Sep 28, 2024

Without this final line-ending, reordering steps will fail because tables will be added directly to the previous value (see issue #381)

when creating the string from the Container again, we remove any final line-ending if we added it initially to ensure we do not modify the original behavior

This modification only fails on two unit tests. However, I do not know enough about the TOML specifiation to see why this is a problem. Is there anybody that could help out and point me to a direction on how I can fix these final two unit tests?

Without this final line-ending, reordering steps will fail because
tables will be added directly to the previous value (see issue python-poetry#381)

when creating the string from the Container again, we remove any final
line-ending if we added it initially to ensure we do not modify the
original behavior
@gdiepen
Copy link
Author

gdiepen commented Sep 29, 2024

Checked the two unit tests that are failing, one is doing a parse, copy, as_string of [foo]\nbar=1\n and after the three steps, it is now missing the final newline.

Would this not need to actually have the trailing newline?

The other unit tests that now fails is parsing the value:
tomlkit.array("""[\n"alpha",\n"omega"\n]""")

Not sure how I would need to fix this.

An alternative to my current approach of adding a final new-line to the input string would be to fix this when reordering the items in an array instead.

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.

1 participant