Skip to content

Commit

Permalink
more python testing cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Mar 7, 2024
1 parent 5ea1cee commit 8f501ac
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 35 deletions.
2 changes: 2 additions & 0 deletions crates/re_types/definitions/rerun/datatypes/uint32.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace rerun.datatypes;
/// A 32bit unsigned integer.
struct UInt32 (
"attr.arrow.transparent",
"attr.python.aliases": "int",
"attr.python.array_aliases": "int, npt.NDArray[np.uint32]",
"attr.rust.derive": "Copy, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.override_crate": "re_types_core",
"attr.rust.tuple_struct"
Expand Down
2 changes: 2 additions & 0 deletions crates/re_types/definitions/rerun/datatypes/uint64.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace rerun.datatypes;
/// A 64bit unsigned integer.
struct UInt64 (
"attr.arrow.transparent",
"attr.python.aliases": "int",
"attr.python.array_aliases": "int, npt.NDArray[np.uint64]",
"attr.rust.derive": "Copy, PartialEq, Eq, PartialOrd, Ord",
"attr.rust.override_crate": "re_types_core",
"attr.rust.tuple_struct",
Expand Down

This file was deleted.

13 changes: 7 additions & 6 deletions rerun_py/rerun_sdk/rerun/datatypes/uint32.py

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

2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/datatypes/uint32_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class UInt32Ext:
"""Extension for [UInt32][rerun.components.UInt32]."""
"""Extension for [UInt32][rerun.datatypes.UInt32]."""

@staticmethod
def native_to_pa_array_override(data: UInt32ArrayLike, data_type: pa.DataType) -> pa.Array:
Expand Down
13 changes: 7 additions & 6 deletions rerun_py/rerun_sdk/rerun/datatypes/uint64.py

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

2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/datatypes/uint64_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class UInt64Ext:
"""Extension for [UInt64][rerun.components.UInt64]."""
"""Extension for [UInt64][rerun.datatypes.UInt64]."""

@staticmethod
def native_to_pa_array_override(data: UInt64ArrayLike, data_type: pa.DataType) -> pa.Array:
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/tests/unit/test_space_view_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_space_view_contents() -> None:
query_array,
)

for query in all_arrays:
for (query,) in all_arrays:
# query = query if query is not None else query_array[-1]

# mypy can't track types properly through itertools zip so re-cast
Expand Down
15 changes: 13 additions & 2 deletions rerun_py/tests/unit/test_viewport_blueprint.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
from __future__ import annotations

import itertools
from typing import Optional, cast

from rerun.blueprint.archetypes.viewport_blueprint import ViewportBlueprint
from rerun.blueprint.components.auto_layout import AutoLayoutBatch
from rerun.blueprint.components.auto_space_views import AutoSpaceViewsBatch
from rerun.blueprint.components.auto_layout import AutoLayoutBatch, AutoLayoutLike
from rerun.blueprint.components.auto_space_views import AutoSpaceViewsBatch, AutoSpaceViewsLike
from rerun.blueprint.components.included_space_view import IncludedSpaceViewBatch
from rerun.blueprint.components.root_container import RootContainerBatch
from rerun.blueprint.components.space_view_maximized import SpaceViewMaximizedBatch
from rerun.blueprint.components.viewer_recommendation_hash import (
ViewerRecommendationHash,
ViewerRecommendationHashBatch,
)
from rerun.datatypes.uint64 import UInt64ArrayLike
from rerun.datatypes.uuid import UuidArrayLike, UuidLike

from .common_arrays import none_empty_or_value, uuid_bytes0, uuid_bytes1, uuids_arrays

Expand Down Expand Up @@ -53,6 +56,14 @@ def test_viewport_blueprint() -> None:
) in all_arrays:
space_views = space_views if space_views is not None else space_views_arrays[-1]

# mypy can't track types properly through itertools zip so re-cast
space_views = cast(UuidArrayLike, space_views)
root_container = cast(Optional[UuidLike], root_container)
maximized = cast(Optional[UuidLike], maximized)
auto_layout = cast(Optional[AutoLayoutLike], auto_layout)
auto_space_views = cast(Optional[AutoSpaceViewsLike], auto_space_views)
viewer_recommendation_hashes = cast(Optional[UInt64ArrayLike], viewer_recommendation_hashes)

print(
"rr.ViewportBlueprint(\n",
f" space_views={space_views!r}\n",
Expand Down

0 comments on commit 8f501ac

Please sign in to comment.