Skip to content

Commit

Permalink
Merge pull request #41 from casework/test_type_annotations
Browse files Browse the repository at this point in the history
Test type annotations
  • Loading branch information
fabrizio-turchi authored Mar 13, 2024
2 parents fa4f7a9 + 9798b5e commit edfeea1
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Pre-commit Checks
run: pre-commit run --all-files

- name: Type Checking
run: poetry run mypy case_mapping example.py tests

- name: Unit Tests
run: poetry run pytest --doctest-modules

Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ all: \
.venv-pre-commit/var/.pre-commit-built.log \
case.jsonld

.PHONY: \
check-mypy

# This virtual environment is meant to be built once and then persist, even through 'make clean'.
# If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
.venv-pre-commit/var/.pre-commit-built.log:
Expand Down Expand Up @@ -101,6 +104,15 @@ case.ttl: \

check: \
all \
check-mypy \
case.ttl
source venv/bin/activate \
&& poetry run pytest --doctest-modules

check-mypy: \
.venv.done.log
source venv/bin/activate \
&& mypy \
case_mapping \
example.py \
tests
2 changes: 1 addition & 1 deletion case_mapping/uco/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(
The main CASE Object for representing a case and its activities and objects.
"""
super().__init__(*args, **kwargs)
self.build = []
self.build = [] # type: ignore
self["@context"] = {
"@vocab": "http://caseontology.org/core#",
"case-investigation": "https://ontology.caseontology.org/case/investigation/",
Expand Down
84 changes: 82 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ python = "^3.9"
pytz = "^2023.3.post1"

[tool.poetry.dev-dependencies]
mypy = "^1"
pytest = "^7.4.2"
types-pytz = "^2024"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit edfeea1

Please sign in to comment.