Closed ivanpuchalka closed 4 months ago
Thanks!
The tests break when there are changes in the output, they are a bit weird in that way, but it is by design. There’s a make action to update them. I uses the git diff in the generated output to validate that any changes were good :)
Fixes #10.
To ensure the generated string is a valid Python literal, this new code manually creates an instance of an AST constant node with the value parsed from the HAR and then uses
ast.unparse
.A few details worth reviewing:
The literal generation is implemented as an
entriesprocessor_with_args
defined in the main module, I don't think it fits as a plugin because it needs to be executed for the program to work properly.Since the output now includes the enclosing quotes, I removed them from the default template.
With the changes, the
apple-buy-a-mac
test started to fail. It seems the test was wrong: the expected output ignored backslashes that should be in the string, but got interpreted as part of a double quote escape sequence. It's now changed to reflect the correct expected output (and correct behaviour).