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

Fixes #422. Currently this new test_bug_148 will be failed. Think TDD. #423

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JamesParrott
Copy link

Note, this test is currently supposed to be failed by the current toml release. The next PR I submit will create another version that will pass it. The original test was incorrect, and has masked a bug. Fixing that is the whole point of this and the next PR.

Code containing a bug should fail a correctly written test designed to find it (such as this new test).

This PR changes the expected outputs on the LHSs to the same outputs from tomli-w and tomlkit. This test function in its factory form has been tested against tomli-w, tomlkit and against the patched version I will shortly submit in my next PR. It has also been tested in its inverse form (toml.loads on the LHS instead of toml.dumps on the RHS) against tomli, tomli-w, tomlkit, my patched version (toml_tools), against the Python 3.11 native tomllib, and against this libraries own toml.loads. All pass.

Also changes normal string literals to raw string literals, to make it easier to count the number of back slashes in the input to actual, and in the expected result .

This test could be more extensive, e.g. to make sure r''*n + '\x64' -> r'\'*n +'d'. Great! Lets write more tests!

Just lets do one thing and one thing only here - further tests deserve their own PRs.

…ever fixed.

Note, this test is currently supposed to be failed by the current toml, until the next PR I submit, which will create another version that will pass it.  That's the whole point of this PR (put your TDD hat on).

This PR changes the expected outputs on the LHSs to the same outputs from tomli-w and tomlkit.  This test function in its factory form has been tested against tomli-w, tomlkit and against the patched version I will shortly submit in my next PR.  It has also been tested in its inverse form (toml.loads on the LHS instead of toml.dumps on the RHS) against tomli, tomli-w, tomlkit, my patched version (toml_tools), against the Python 3.11 native tomllib, and against this libraries own toml.loads.  All pass.

Also changes normal string literals to raw string literals, to make it easier to count the number of back slashes in the input to actual, and in the expected result .

This test could be more extensive, e.g. to make sure r'\'*n + '\x64' -> r'\\'*n +'d'.  Great!  Lets write more tests!

Just lets do one thing and one thing only here - further tests deserve their own PRs.
…ate)

Also adds some sorely needed comments.  Apologies if I got carried away with those, but they're only comments.
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