-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: fix failing tests #128
Conversation
tests/test_multi.py
Outdated
@@ -36,7 +36,7 @@ class N: | |||
class A: | |||
a: N | |||
|
|||
assert multi.string("a { b = 1\nc = 2 }").string("a { c = 3\nd = 4 }").on( | |||
assert multi.string("a { b = 1,\nc = 2 }").string("a { c = 3,\nd = 4 }").on( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comma should not be required in the spec, likely the issue is with windows using \r\n
and \n
, can you try with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if I try with \r\n, the result is the same:
FAILED tests/test_multi.py::TestMulti::test_complex - pyparsing.exceptions.ParseSyntaxException: , found '=' (at char 13), (line:2, col:3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you did not upgrade vyparsing by mistake: https://github.com/zifeo/dataconf/blob/main/poetry.lock#L449
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pyparsing 3.1.1.
I'm going to debug this test case in details hopefully tonight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange. This fails:
assert multi.string("a { b = 1\nc = 2 }").string("a { c = 3\nd = 4 }").on( A ) == A(a=N(b=1, c=3, d=4))
But this, basically the same assertion, but passes:
assert multi.string("a { b = 1\nc = 2 }").string("a { d = 4\nc = 3 }").on( A ) == A(a=N(b=1, c=3, d=4))
Difference is that in the second string c and d swapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of weirdness in the latest pyhocon change (that bumped pyparsing): https://github.com/chimpler/pyhocon/issues?q=is%3Aissue+is%3Aopen+0.3.60, I would stick at pyparsing v2 and those issues should be gone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that my testcase is passing with pyhocon==0.3.59 and pyparsing==2.4.7. Should dataconf depend on these versions instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please and we can merge your PR 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine! is it enough to update version in pyproject.toml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated also poetry.lock
@szevzol thanks for the contribution and happy 2024 |
My first intention was to use your library in my production config handling, to take advantage of classes in the code when reading config data. (Thank you for your work!)
My issue was that I had "null" values in my yaml file and dataconf cannot handle them today as far as I've seen. However I removed those null values and decided to see how I can improve dataconf to handle null.
To be able to do that first I would like to fix failing unit tests.
I'm working on Win 10, using python 3.9.6.