Fixes #422. Currently this new test_bug_148 will be failed. Think TDD.#423
Open
JamesParrott wants to merge 4 commits intouiri:masterfrom
Open
Fixes #422. Currently this new test_bug_148 will be failed. Think TDD.#423JamesParrott wants to merge 4 commits intouiri:masterfrom
JamesParrott wants to merge 4 commits intouiri:masterfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.