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

hocr-check: Replace assert calls with basic TAP ok test #45

Merged
merged 1 commit into from
Sep 2, 2016

Conversation

kba
Copy link
Contributor

@kba kba commented Sep 1, 2016

Here's a really simplistic approach on how hocr-check can be more useful.

  • test function 'test_ok(boolean, message)' instead of assert
  • Failing tests will write 'not ok' and the message
  • Passing tests will write 'ok' and the message

* test function 'test_ok(boolean, message)'
* Failing tests will write 'not ok' and the message
* Passing tests will write 'ok' and the message
for line in lines:
assert line.xpath("//*[@class='ocr_page']")
for line_idx, line in enumerate(lines):
test_ok(line.xpath("//*[@class='ocr_page']"), "ocr_line %2d in a ocr_page"%(line_idx))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this checking for a ocr_page inside the line element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are supposed to check for the opposite but don't and should be fixed. All those tests in for loops.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, and the current tests are just checking that it is possible to execute hocr-check with the correct parameters. I guess that the current output of the command is showing not okay lines. Correct?

Copy link
Contributor Author

@kba kba Sep 2, 2016

Choose a reason for hiding this comment

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

//*[@class='ocr..'] without context starts at root, so will output ok. Your expected behavior is for .//*[@class='ocr..']

@zuphilip zuphilip merged commit 738ce4a into ocropus:master Sep 2, 2016
@zuphilip zuphilip mentioned this pull request Sep 2, 2016
8 tasks
@kba
Copy link
Contributor Author

kba commented Sep 2, 2016

Thanks for merging, you can see the output at http://digi.bib.uni-mannheim.de/ocr-fileformat/#validate

kba added a commit to kba/hocr-tools that referenced this pull request Sep 15, 2016
* test function 'test_ok(boolean, message)'
* Failing tests will write 'not ok' and the message
* Passing tests will write 'ok' and the message
@kba kba deleted the hocr-check-tap branch September 16, 2016 01:52
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