Skip to content

Commit edfeea1

Browse files
Merge pull request #41 from casework/test_type_annotations
Test type annotations
2 parents fa4f7a9 + 9798b5e commit edfeea1

File tree

5 files changed

+100
-3
lines changed

5 files changed

+100
-3
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: Pre-commit Checks
3131
run: pre-commit run --all-files
3232

33+
- name: Type Checking
34+
run: poetry run mypy case_mapping example.py tests
35+
3336
- name: Unit Tests
3437
run: poetry run pytest --doctest-modules
3538

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ all: \
3434
.venv-pre-commit/var/.pre-commit-built.log \
3535
case.jsonld
3636

37+
.PHONY: \
38+
check-mypy
39+
3740
# This virtual environment is meant to be built once and then persist, even through 'make clean'.
3841
# If a recipe is written to remove this flag file, it should first run `pre-commit uninstall`.
3942
.venv-pre-commit/var/.pre-commit-built.log:
@@ -101,6 +104,15 @@ case.ttl: \
101104

102105
check: \
103106
all \
107+
check-mypy \
104108
case.ttl
105109
source venv/bin/activate \
106110
&& poetry run pytest --doctest-modules
111+
112+
check-mypy: \
113+
.venv.done.log
114+
source venv/bin/activate \
115+
&& mypy \
116+
case_mapping \
117+
example.py \
118+
tests

case_mapping/uco/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(
1717
The main CASE Object for representing a case and its activities and objects.
1818
"""
1919
super().__init__(*args, **kwargs)
20-
self.build = []
20+
self.build = [] # type: ignore
2121
self["@context"] = {
2222
"@vocab": "http://caseontology.org/core#",
2323
"case-investigation": "https://ontology.caseontology.org/case/investigation/",

poetry.lock

Lines changed: 82 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ python = "^3.9"
2323
pytz = "^2023.3.post1"
2424

2525
[tool.poetry.dev-dependencies]
26+
mypy = "^1"
2627
pytest = "^7.4.2"
28+
types-pytz = "^2024"
2729

2830
[build-system]
2931
requires = ["poetry-core"]

0 commit comments

Comments
 (0)