-
Notifications
You must be signed in to change notification settings - Fork 56
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 locator conditions (resolve #142) #143
Conversation
could a test be added which would catch original bug and now pass? |
Is there any directory holding similars tests? I suggest adding a local directory similar to |
@yarikoptic In 8ae7c71, I added a directory for local tests in the format of the test-suite. In the master branch, the bug is revealed as follows. $ PYTHONPATH=. py tests/citeproc-test.py condition_LocatorVariables -v
>>> Testing condition_LocatorVariables.txt
EXP: (Doe)
(Doe 23)
RES: ()
(Doe 23)
<<< FAILED My patch fixes the bug. $ PYTHONPATH=. py tests/citeproc-test.py condition_LocatorVariables -v
>>> Testing condition_LocatorVariables.txt
EXP: (Doe)
(Doe 23)
RES: (Doe)
(Doe 23)
<<< SUCCESS |
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.
Thanks @zepinglee. The change looks great and for adding the local test structure. Apologies for the delay in getting this looked at.
@zepinglee Could you rebase this PR so the CI can run? I tried to do it for you but don't seem to have permission. |
@@ -22,6 +22,7 @@ | |||
'test-suite')) | |||
TEST_PARSER_PATH = os.path.join(CITEPROC_TEST_PATH, 'processor.py') | |||
TESTS_PATH = os.path.join(CITEPROC_TEST_PATH, 'processor-tests', 'humans') | |||
LOCAL_TESTS_PATH = os.path.join(os.path.dirname(__file__), "local") |
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.
what meaning did you imply by "local"? should it be may be "resources" or "files"?
in any case -- would also need to tune up MANIFEST.in
to include .txt files I guess.
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.
what meaning did you imply by "local"? should it be may be "resources" or "files"?
It means local tests in this repository rather than tests from the standard test-suite. It's named following the fixtures/local
directory of citeproc-js.
in any case -- would also need to tune up
MANIFEST.in
to include .txt files I guess.
I've added 7ade76c.
Done. |
MANIFEST.in
Outdated
@@ -4,3 +4,4 @@ recursive-include docs *.html *.css *.png | |||
recursive-include examples *.py *.csl *.bib | |||
recursive-include tests *.py *.bib | |||
prune tests/citeproc-test | |||
prune tests/local |
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.
it should be included, not pruned per se. tests/citeproc-test
seems to be some clone which tests do "behind the curtain". I think you should instead add *.txt
into line above
recursive-include tests *.py *.bib *.txt
and please check if it does include those files in source distribution
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.
it should be included, not pruned per se.
tests/citeproc-test
seems to be some clone which tests do "behind the curtain". I think you should instead add*.txt
into line above
I've modified in dbbb5de.
and please check if it does include those files in source distribution
Yes, the tests/local/*.txt
files are included.
This patch fixes issue #142.
In the original code,
item.locator.label
raisesVariableError
since there is nolocator
in the CitationItem. This error is then ignored inprocess_children()
called inLayout.render_citation()
, which causes empty output.citeproc-py/citeproc/model.py
Lines 1470 to 1472 in d7fb0a0
citeproc-py/citeproc/model.py
Lines 551 to 556 in d7fb0a0