#4 Samples don't work

Open
opened 6 months ago by Jason · 2 comments
Jason commented 6 months ago
Collaborator

I tried both samples and found they did not work. Pull req has fixes

sample1.py
Altered the expected outputs to match what is obtained (removed elipses)
Added a repr to Parameter object so that it matches (now uses (Sumbol(x))
previous version was comparing main.x with sample1.x
add

sample2.py
Moved the ini_file_text from the main to the body, changed to a join of lists to make compatible with doctest.
Altered the expected outputs to match what is obtained (removed elipses)

Note passing ELIPSES to the doctest.testmod call does not work, you need to put # doctest: +ELIPSES on the test line.

I tried both samples and found they did not work. Pull req has fixes sample1.py Altered the expected outputs to match what is obtained (removed elipses) Added a repr to Parameter object so that it matches (now uses (Sumbol(x)) previous version was comparing __main__.x with __sample1__.x add <BLANKLINE> sample2.py Moved the ini_file_text from the __main__ to the body, changed to a join of lists to make compatible with doctest. Altered the expected outputs to match what is obtained (removed elipses) Note passing ELIPSES to the doctest.testmod call does not work, you need to put # doctest: +ELIPSES on the test line.
Jason commented 6 months ago
Poster
Collaborator

There is still a problem.

It appers lxml and etree behave every so slightly differently.

etree adds a space on single line elements.

<Parameter typing="int" name="a" />

whereas lxml does not

<Parameter typing="int" name="a"/>

This can be fixed with elipses (...)

lxml emits a CRLF at the end of the tostring() and needs a corresponding in the doctest, etree does not.

I think the answer is to always use etree for tostring even if lxml is in use as etree is in the standard library and lxml is not

There is still a problem. It appers lxml and etree behave every so slightly differently. etree adds a space on single line elements. ```xml <Parameter typing="int" name="a" /> ``` whereas lxml does not ```xml <Parameter typing="int" name="a"/> ``` This can be fixed with elipses (...) lxml emits a CRLF at the end of the tostring() and needs a corresponding <BLANKLINE> in the doctest, etree does not. I think the answer is to always use etree for tostring even if lxml is in use as etree is in the standard library and lxml is not
Jason commented 6 months ago
Poster
Collaborator

Ok I think that's fixed. adding end="" to the print prevents a trailing CRLF

Ok I think that's fixed. adding end="" to the print prevents a trailing CRLF
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.