Skip to content

Commit

Permalink
Add test case for language tags pattern
Browse files Browse the repository at this point in the history
GitHub issue: #552
  • Loading branch information
bozhodimitrov committed Nov 22, 2024
1 parent 6e4f31c commit a36b406
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
run: tox -e ${{ matrix.env != env.PYTHON_LATEST_TAG && matrix.env || 'pandas' }}
- name: Test pytesseract package installation
if: ${{ matrix.env == env.PYTHON_LATEST_TAG }}
run: python -mpip install -U . && python -mpip show pytesseract && python -c 'import pytesseract'
run: python -mpip install -U . && python -mpip show pytesseract && python -c 'import pytesseract'
18 changes: 18 additions & 0 deletions tests/pytesseract_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from pytesseract import TesseractNotFoundError
from pytesseract import TSVNotSupported
from pytesseract.pytesseract import file_to_dict
from pytesseract.pytesseract import LANG_PATTERN
from pytesseract.pytesseract import numpy_installed
from pytesseract.pytesseract import pandas_installed
from pytesseract.pytesseract import prepare
Expand Down Expand Up @@ -518,3 +519,20 @@ def test_get_tesseract_version_invalid(tesseract_version, expected_msg):

(msg,) = e.value.args
assert msg == expected_msg


@pytest.mark.parametrize(
'lang',
[
'bhu',
'eng',
'bhu_eng',
'eng_bhu',
'7seg',
'bhu32',
'bhu32_7seg',
'7seg_eng',
],
)
def test_allowed_language_formats(lang):
assert LANG_PATTERN.match(lang)

0 comments on commit a36b406

Please sign in to comment.