Skip to content

Commit

Permalink
Add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Feb 5, 2024
1 parent 8d8ca88 commit d1c5929
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/integration/dataset/test_bounding_box_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_default(empty_dataset: spotlight.Dataset) -> None:
empty_dataset.append_bounding_box_column("column")
assert empty_dataset.get_dtype("column") == dtypes.bounding_box_dtype

valid_values = (
valid_values: tuple = (
[0, 1, 2, 3],
[0.0, 1.0, np.nan, np.inf],
range(4),
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_optional(empty_dataset: spotlight.Dataset) -> None:
empty_dataset.append_bounding_box_column("column", optional=True)
assert empty_dataset.get_dtype("column") == dtypes.bounding_box_dtype

valid_values = (
valid_values: tuple = (
[0, 1, 2, 3],
[0.0, 1.0, np.nan, np.inf],
range(4),
Expand Down
12 changes: 5 additions & 7 deletions tests/integration/dataset/test_embedding_column.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from typing import Tuple
import numpy as np
import pytest

from renumics import spotlight
from renumics.spotlight import dtypes
from renumics.spotlight.dataset.exceptions import InvalidDTypeError, InvalidShapeError
from renumics.spotlight.dataset.typing import EmbeddingColumnInputType


@pytest.mark.parametrize("length", [1, 2, 8])
Expand All @@ -16,7 +14,7 @@ def test_default(empty_dataset: spotlight.Dataset, length: int) -> None:
empty_dataset.append_embedding_column("embedding")
assert empty_dataset.get_dtype("embedding") == dtypes.embedding_dtype

valid_values: Tuple[EmbeddingColumnInputType] = (
valid_values: tuple = (
[0] * length,
range(length),
tuple(range(length)),
Expand Down Expand Up @@ -69,7 +67,7 @@ def test_default_with_values(empty_dataset: spotlight.Dataset, length: int) -> N
Test default embedding column creation with given values and afterwards
filling row-by-row.
"""
valid_values = (
valid_values: tuple = (
[0] * length,
range(length),
tuple(range(length)),
Expand Down Expand Up @@ -194,7 +192,7 @@ def test_length(empty_dataset: spotlight.Dataset, length: int) -> None:
empty_dataset.append_embedding_column("embedding", length=length)
assert empty_dataset.get_dtype("embedding") == dtypes.EmbeddingDType(length=length)

valid_values = (
valid_values: tuple = (
[0] * length,
range(length),
tuple(range(length)),
Expand Down Expand Up @@ -256,7 +254,7 @@ def test_dtype(
empty_dataset.append_embedding_column("embedding", dtype=np_dtype)
assert empty_dataset.get_dtype("embedding") == dtypes.embedding_dtype

valid_values = (
valid_values: tuple = (
[0] * length,
range(length),
tuple(range(length)),
Expand Down Expand Up @@ -284,7 +282,7 @@ def test_generic(empty_dataset: spotlight.Dataset, length: int) -> None:
empty_dataset.append_column("embedding", dtype)
assert empty_dataset.get_dtype("embedding") == dtype

valid_values = (
valid_values: tuple = (
[0] * length,
range(length),
tuple(range(length)),
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/h5/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"""

import datetime
from typing import Dict, Tuple

import numpy as np
from renumics import spotlight


COLUMNS = {
COLUMNS: Dict[str, Tuple[str, list]] = {
"bool": ("bool", [True, False]),
"int": ("int", [0, 1]),
"float": ("float", [0.0, np.nan]),
Expand Down

0 comments on commit d1c5929

Please sign in to comment.