Skip to content

Commit

Permalink
Merge pull request #4 from explosion/add-tests
Browse files Browse the repository at this point in the history
Added extra tests
  • Loading branch information
koaning authored Oct 24, 2023
2 parents f0cd5f9 + 0d34df0 commit b5768a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prodigy_pdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def pdf_image_manual(
) -> ControllerComponentsDict:
"""Turns pdfs into images in order to annotate them."""
# Read in stream as a list for progress bar.
if not pdf_folder.exists():
if not Path(pdf_folder).exists():
msg.fail(f"Folder `{pdf_folder}` does not exist.", exits=True)
pdf_paths = list(Path(pdf_folder).glob("*.pdf"))
if len(pdf_paths) == 0:
Expand Down
9 changes: 7 additions & 2 deletions tests/test_basics.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pathlib import Path
from prodigy_pdf import generate_pdf_pages, fold_ocr_dashes
from prodigy_pdf import generate_pdf_pages, fold_ocr_dashes, pdf_image_manual


def test_smoke_internal():
def test_generate_pdf_pages():
# We know this one PDF has six pages.
paths = Path("tests/pdfs").glob("*.pdf")
pages = list(generate_pdf_pages(paths))
Expand All @@ -29,3 +29,8 @@ def test_fold_dashes():

expected = "Real-Time Strategy (RTS) games have become an increasingly popular test-bed for modern artificial intelligence techniques. With this rise in popularity has come the creation of several annual competitions, in which AI agents (bots) play the full game of StarCraft: Broodwar by Blizzard Entertainment. The three major annual StarCraft AI Competitions are the Student StarCraft AI Tournament (SSCAIT), the Computational Intelligence in Games (CIG) competition, and the Artificial Intelligence and Interactive Digital Entertainment (AIIDE) competition. In this paper we will give an overview of the current state of these competitions, and the bots that compete in them."
assert fold_ocr_dashes(going_in) == expected


def test_pdf_image_manual():
components = pdf_image_manual("xxx", "tests/pdfs", "foo,bar")
assert isinstance(next(components["stream"]), dict)

0 comments on commit b5768a2

Please sign in to comment.