Simplified type hints

This commit is contained in:
Andrew Murray 2024-02-20 21:27:30 +11:00
parent e39765d755
commit a655d7606e

View File

@ -6,6 +6,7 @@ import re
import shutil
from io import BytesIO
from pathlib import Path
from typing import Any
import pytest
@ -336,25 +337,13 @@ def test_extended_information() -> None:
p = o.profile
def assert_truncated_tuple_equal(
tup1: tuple[tuple[float, float, float], ...] | tuple[float],
tup2: (
tuple[tuple[tuple[float, float, float], ...], ...]
| tuple[tuple[float, float, float], ...]
| tuple[float]
),
digits: int = 10,
tup1: tuple[Any, ...], tup2: tuple[Any, ...], digits: int = 10
) -> None:
# Helper function to reduce precision of tuples of floats
# recursively and then check equality.
power = 10**digits
def truncate_tuple(
tuple_or_float: (
tuple[tuple[tuple[float, float, float], ...], ...]
| tuple[tuple[float, float, float], ...]
| tuple[float, ...]
)
) -> tuple[tuple[float, ...], ...]:
def truncate_tuple(tuple_or_float: tuple[Any, ...]) -> tuple[Any, ...]:
return tuple(
(
truncate_tuple(val)