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

fix: fix failing tests #128

Merged
merged 5 commits into from
Jan 1, 2024
Merged

fix: fix failing tests #128

merged 5 commits into from
Jan 1, 2024

Conversation

szevzol
Copy link
Contributor

@szevzol szevzol commented Dec 29, 2023

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.

@szevzol szevzol changed the title Fix failing tests fix: fix failing tests Dec 29, 2023
@@ -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(
Copy link
Owner

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?

Copy link
Contributor Author

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)

Copy link
Owner

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

Copy link
Contributor Author

@szevzol szevzol Dec 29, 2023

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.

Copy link
Contributor Author

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.

Copy link
Owner

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

Copy link
Contributor Author

@szevzol szevzol Jan 1, 2024

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?

Copy link
Owner

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 👍

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated also poetry.lock

tests/test_regression.py Show resolved Hide resolved
tests/test_regression.py Outdated Show resolved Hide resolved
@zifeo zifeo merged commit d6e2e3b into zifeo:main Jan 1, 2024
8 checks passed
@zifeo
Copy link
Owner

zifeo commented Jan 1, 2024

@szevzol thanks for the contribution and happy 2024

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.

2 participants