diff --git a/tests/adapters/test_sql.py b/tests/adapters/test_sql.py index 0d627004e..58f236df7 100644 --- a/tests/adapters/test_sql.py +++ b/tests/adapters/test_sql.py @@ -284,12 +284,10 @@ def assert_same_rows(table1: pa.Table, table2: pa.Table) -> None: ("adapter_psql_many_partitions"), ], ) -def test_append_single_partition( - adapter: SQLAdapter, request: pytest.FixtureRequest -) -> None: +def test_append_single_partition(adapter: str, request: pytest.FixtureRequest) -> None: # get adapter from fixture adapter = request.getfixturevalue(adapter) - + assert isinstance(adapter, SQLAdapter) # test writing an entire pyarrow table to a single partition table = pa.Table.from_batches([batch0, batch1, batch2]) adapter.append_partition(0, table) @@ -312,11 +310,11 @@ def test_append_single_partition( ], ) def test_write_read_one_batch_many_part( - adapter: SQLAdapter, request: pytest.FixtureRequest + adapter: str, request: pytest.FixtureRequest ) -> None: # get adapter from fixture adapter = request.getfixturevalue(adapter) - + assert isinstance(adapter, SQLAdapter) # test writing to many partitions and reading it whole adapter.append_partition(0, batch0) adapter.append_partition(1, batch1) diff --git a/tests/adapters/test_sql_types.py b/tests/adapters/test_sql_types.py index 91c6538f0..c8da15651 100644 --- a/tests/adapters/test_sql_types.py +++ b/tests/adapters/test_sql_types.py @@ -28,12 +28,12 @@ async def postgresql_uri() -> AsyncGenerator[str, None]: # yield uri_with_database_name.rsplit("/", 1)[0] -@pytest_asyncio.fixture +@pytest.fixture def sqlite_uri(tmp_path: Path) -> Generator[str, None, None]: yield f"sqlite:///{tmp_path}/test.db" -@pytest_asyncio.fixture +@pytest.fixture def duckdb_uri(tmp_path: Path) -> Generator[str, None, None]: yield f"duckdb:///{tmp_path}/test.db" diff --git a/tests/test_protocols.py b/tests/test_protocols.py index a8b702eb3..736e235ea 100644 --- a/tests/test_protocols.py +++ b/tests/test_protocols.py @@ -1,3 +1,4 @@ +import uuid from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union @@ -444,7 +445,7 @@ async def test_accesspolicy_protocol(mocker: MockFixture) -> None: metadata: JSON = {"foo": "bar"} container = DirectoryContainer(directory=Path("somedirectory"), form={}) principal = Principal( - uuid="12345678124123412345678123456781", type=PrincipalType.user + uuid=uuid.UUID(int=0x12345678124123412345678123456781), type=PrincipalType.user ) authn_access_tags = {"qux", "quux"} authn_scopes = {"abc", "baz"} diff --git a/tiled/adapters/hdf5.py b/tiled/adapters/hdf5.py index 537a1a9e7..d353a796e 100644 --- a/tiled/adapters/hdf5.py +++ b/tiled/adapters/hdf5.py @@ -249,12 +249,12 @@ def from_catalog( array = cls.lazy_load_hdf5_array( *file_paths, dataset=dataset, swmr=swmr, libver=libver, locking=locking ) - if slice: if isinstance(slice, str): slice = NDSlice.from_numpy_str(slice) array = array[slice] if squeeze: + assert isinstance(array, dask.array.Array) array = array.squeeze() if array.dtype != structure.data_type.to_numpy_dtype(): diff --git a/tiled/adapters/mapping.py b/tiled/adapters/mapping.py index ed90265fa..b4e91bd22 100644 --- a/tiled/adapters/mapping.py +++ b/tiled/adapters/mapping.py @@ -362,8 +362,8 @@ def sort(self, sorting: SortingItem) -> "MapAdapter[A]": """ mapping = copy.copy(self._mapping) - for key, direction in reversed(sorting): - if key == "_": + for item in sorting: + if item.key == "_": # Special case to enable reversing the given/default ordering. # Leave mapping as is, and possibly reserve it below. pass @@ -371,11 +371,11 @@ def sort(self, sorting: SortingItem) -> "MapAdapter[A]": mapping = dict( sorted( mapping.items(), - key=lambda item: item[1].metadata().get(key, _HIGH_SORTER), # type: ignore + key=lambda item: item[1].metadata().get(key, _HIGH_SORTER), ) ) - if direction < 0: + if item.direction < 0: # TODO In Python 3.8 dict items should be reversible # but I have seen errors in the wild that I could not # quickly resolve so for now we convert to list in the middle. diff --git a/tiled/adapters/netcdf.py b/tiled/adapters/netcdf.py index 6f6743200..ebe516f52 100644 --- a/tiled/adapters/netcdf.py +++ b/tiled/adapters/netcdf.py @@ -11,7 +11,7 @@ from .xarray import DatasetAdapter -def read_netcdf(filepath: Union[str, List[str], Path]) -> DatasetAdapter: +def read_netcdf(filepath: Union[str, Path]) -> DatasetAdapter: """ Parameters