chore: partially fix linting

This commit is contained in:
Gergő Jedlicska
2025-02-08 15:42:54 +01:00
parent adc0c40ab7
commit 06e21154c4
21 changed files with 192 additions and 174 deletions
+2 -2
View File
@@ -1,8 +1,9 @@
from dataclasses import dataclass, field
from typing import Dict, List
from specklepy.logging.exceptions import SpeckleException
from specklepy.objects.base import Base
from specklepy.objects.interfaces import IDataObject, IGisObject, IHasUnits
from specklepy.logging.exceptions import SpeckleException
@dataclass(kw_only=True)
@@ -12,7 +13,6 @@ class DataObject(
speckle_type="Objects.Data.DataObject",
detachable={"displayValue"},
):
name: str
properties: Dict[str, object]
displayValue: List[Base]
+1 -9
View File
@@ -7,12 +7,4 @@ from specklepy.objects.geometry.polyline import Polyline
from specklepy.objects.geometry.vector import Vector
# re-export them at the geometry package level
__all__ = [
"Arc",
"Line",
"Mesh",
"Plane",
"Point",
"Polyline",
"Vector"
]
__all__ = ["Arc", "Line", "Mesh", "Plane", "Point", "Polyline", "Vector"]
+6 -4
View File
@@ -23,8 +23,9 @@ class Arc(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Arc"):
start_to_mid = self.startPoint.distance_to(self.midPoint)
mid_to_end = self.midPoint.distance_to(self.endPoint)
r = self.radius
angle = (2 * math.asin(start_to_mid / (2 * r))) + \
(2 * math.asin(mid_to_end / (2 * r)))
angle = (2 * math.asin(start_to_mid / (2 * r))) + (
2 * math.asin(mid_to_end / (2 * r))
)
return r * angle
@property
@@ -32,5 +33,6 @@ class Arc(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Arc"):
start_to_mid = self.startPoint.distance_to(self.midPoint)
mid_to_end = self.midPoint.distance_to(self.endPoint)
r = self.radius
return (2 * math.asin(start_to_mid / (2 * r))) + \
(2 * math.asin(mid_to_end / (2 * r)))
return (2 * math.asin(start_to_mid / (2 * r))) + (
2 * math.asin(mid_to_end / (2 * r))
)
+1 -6
View File
@@ -6,12 +6,7 @@ from specklepy.objects.interfaces import ICurve, IHasUnits
@dataclass(kw_only=True)
class Line(
Base,
IHasUnits,
ICurve,
speckle_type="Objects.Geometry.Line"
):
class Line(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Line"):
start: Point
end: Point
+9 -8
View File
@@ -25,6 +25,7 @@ class Mesh(
"""
a 3D mesh consisting of vertices and faces with optional colors and texture coordinates
"""
vertices: List[float]
faces: List[int]
colors: List[int] = field(default_factory=list)
@@ -48,8 +49,9 @@ class Mesh(
if len(self.vertices) % 3 != 0:
raise ValueError(
f"Invalid vertices list: length ({len(
self.vertices)}) must be a multiple of 3"
f"Invalid vertices list: length ({
len(self.vertices)
}) must be a multiple of 3"
)
return len(self.vertices) // 3
@@ -62,19 +64,19 @@ class Mesh(
@property
def area(self) -> float:
return self.__dict__.get('_area', 0.0)
return self.__dict__.get("_area", 0.0)
@area.setter
def area(self, value: float) -> None:
self.__dict__['_area'] = value
self.__dict__["_area"] = value
@property
def volume(self) -> float:
return self.__dict__.get('_volume', 0.0)
return self.__dict__.get("_volume", 0.0)
@volume.setter
def volume(self, value: float) -> None:
self.__dict__['_volume'] = value
self.__dict__["_volume"] = value
def calculate_area(self) -> float:
"""
@@ -180,8 +182,7 @@ class Mesh(
for j in range(vertex_count):
vertex_index = self.faces[i + j + 1]
if vertex_index >= self.vertices_count:
raise IndexError(
f"Vertex index {vertex_index} out of range")
raise IndexError(f"Vertex index {vertex_index} out of range")
vertices.append(self.get_point(vertex_index))
return vertices
+6 -11
View File
@@ -11,6 +11,7 @@ class Polyline(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Polyline"
"""
a polyline curve, defined by a set of vertices.
"""
value: List[float]
def __repr__(self) -> str:
@@ -25,26 +26,20 @@ class Polyline(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Polyline"
# compare first and last points
start = Point(
x=self.value[0],
y=self.value[1],
z=self.value[2],
units=self.units
x=self.value[0], y=self.value[1], z=self.value[2], units=self.units
)
end = Point(
x=self.value[-3],
y=self.value[-2],
z=self.value[-1],
units=self.units
x=self.value[-3], y=self.value[-2], z=self.value[-1], units=self.units
)
return start.distance_to(end) <= tolerance
@property
def length(self) -> float:
return self.__dict__.get('_length', 0.0)
return self.__dict__.get("_length", 0.0)
@length.setter
def length(self, value: float) -> None:
self.__dict__['_length'] = value
self.__dict__["_length"] = value
def calculate_length(self) -> float:
points = self.get_points()
@@ -70,7 +65,7 @@ class Polyline(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Polyline"
x=self.value[i],
y=self.value[i + 1],
z=self.value[i + 2],
units=self.units
units=self.units,
)
points.append(point)
return points
+4 -2
View File
@@ -5,7 +5,9 @@ from specklepy.objects.interfaces import IHasUnits
@dataclass(kw_only=True)
class Vector(Base, IHasUnits, speckle_type="Objects.Geometry.Vector", serialize_ignore = {"length"}):
class Vector(
Base, IHasUnits, speckle_type="Objects.Geometry.Vector", serialize_ignore={"length"}
):
"""
a 3-dimensional vector
"""
@@ -19,4 +21,4 @@ class Vector(Base, IHasUnits, speckle_type="Objects.Geometry.Vector", serialize_
@property
def length(self) -> float:
return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5
return (self.x**2 + self.y**2 + self.z**2) ** 0.5
-3
View File
@@ -41,7 +41,6 @@ class IDisplayValue(Generic[T], metaclass=ABCMeta):
# field interfaces
@dataclass(kw_only=True)
class IHasUnits(metaclass=ABCMeta):
units: str | Units
_units: str = field(repr=False, init=False)
@@ -63,7 +62,6 @@ class IHasUnits(metaclass=ABCMeta):
@dataclass(kw_only=True)
class IHasArea(metaclass=ABCMeta):
_area: float = field(init=False, repr=False)
@property
@@ -79,7 +77,6 @@ class IHasArea(metaclass=ABCMeta):
@dataclass(kw_only=True)
class IHasVolume(metaclass=ABCMeta):
_volume: float = field(init=False, repr=False)
@property
+3 -1
View File
@@ -4,7 +4,9 @@ from specklepy.objects.base import Base
@dataclass(kw_only=True)
class Interval(Base, speckle_type="Objects.Primitive.Interval", serialize_ignore={"length"}):
class Interval(
Base, speckle_type="Objects.Primitive.Interval", serialize_ignore={"length"}
):
start: float = 0.0
end: float = 0.0
+1 -1
View File
@@ -1,4 +1,4 @@
from specklepy.objects.geometry import Point, Line
from specklepy.objects.geometry import Line, Point
from specklepy.objects.models.units import Units
p_1 = Point(x=0, y=0, z=0, units=Units.m)
+8 -23
View File
@@ -27,8 +27,7 @@ def sample_plane():
ydir = Vector(x=0.0, y=1.0, z=0.0, units=Units.m)
plane = Plane(origin=origin, normal=normal,
xdir=xdir, ydir=ydir, units=Units.m)
plane = Plane(origin=origin, normal=normal, xdir=xdir, ydir=ydir, units=Units.m)
return plane
@@ -37,11 +36,7 @@ def sample_plane():
def sample_arc(sample_points, sample_plane):
start, mid, end = sample_points
arc = Arc(
plane=sample_plane,
startPoint=start,
midPoint=mid,
endPoint=end,
units=Units.m
plane=sample_plane, startPoint=start, midPoint=mid, endPoint=end, units=Units.m
)
return arc
@@ -50,11 +45,7 @@ def sample_arc(sample_points, sample_plane):
def test_arc_creation(sample_points, sample_plane):
start, mid, end = sample_points
arc = Arc(
plane=sample_plane,
startPoint=start,
midPoint=mid,
endPoint=end,
units=Units.m
plane=sample_plane, startPoint=start, midPoint=mid, endPoint=end, units=Units.m
)
assert arc.startPoint == start
@@ -71,23 +62,17 @@ def test_arc_domain(sample_arc):
def test_arc_radius(sample_arc):
assert sample_arc.radius == pytest.approx(1.0)
def test_arc_length(sample_arc):
assert sample_arc.length == pytest.approx(math.pi)
def test_arc_units(sample_points, sample_plane):
start, mid, end = sample_points
arc = Arc(
plane=sample_plane,
startPoint=start,
midPoint=mid,
endPoint=end,
units=Units.m
plane=sample_plane, startPoint=start, midPoint=mid, endPoint=end, units=Units.m
)
assert arc.units == Units.m.value
@@ -105,7 +90,7 @@ def test_arc_invalid_construction(sample_points, sample_plane):
startPoint=start,
midPoint=mid,
endPoint=end,
units=Units.m
units=Units.m,
)
with pytest.raises(Exception):
@@ -114,7 +99,7 @@ def test_arc_invalid_construction(sample_points, sample_plane):
startPoint="not a point",
midPoint=mid,
endPoint=end,
units=Units.m
units=Units.m,
)
with pytest.raises(Exception):
@@ -123,7 +108,7 @@ def test_arc_invalid_construction(sample_points, sample_plane):
startPoint=start,
midPoint="not a point",
endPoint=end,
units=Units.m
units=Units.m,
)
with pytest.raises(Exception):
@@ -132,7 +117,7 @@ def test_arc_invalid_construction(sample_points, sample_plane):
startPoint=start,
midPoint=mid,
endPoint="not a point",
units=Units.m
units=Units.m,
)
-7
View File
@@ -8,7 +8,6 @@ from specklepy.objects.primitive import Interval
@pytest.fixture
def sample_points():
p1 = Point(x=0.0, y=0.0, z=0.0, units=Units.m)
p2 = Point(x=3.0, y=4.0, z=0.0, units=Units.m)
return p1, p2
@@ -16,14 +15,12 @@ def sample_points():
@pytest.fixture
def sample_line(sample_points):
start, end = sample_points
line = Line(start=start, end=end, units=Units.m)
return line
def test_line_creation(sample_points):
start, end = sample_points
line = Line(start=start, end=end, units=Units.m)
@@ -33,7 +30,6 @@ def test_line_creation(sample_points):
def test_line_domain(sample_line):
# Domain should be automatically initialized to unit interval by ICurve
assert isinstance(sample_line.domain, Interval)
assert sample_line.domain.start == 0.0
@@ -41,12 +37,10 @@ def test_line_domain(sample_line):
def test_line_length(sample_line):
assert sample_line.length == 5.0
def test_line_units(sample_points):
start, end = sample_points
line = Line(start=start, end=end, units=Units.m)
@@ -58,7 +52,6 @@ def test_line_units(sample_points):
def test_line_serialization(sample_line):
serialized = serialize(sample_line)
deserialized = deserialize(serialized)
+103 -42
View File
@@ -8,77 +8,143 @@ from specklepy.objects.models.units import Units
@pytest.fixture
def cube_vertices():
return [
-0.5, -0.5, -0.5,
0.5, -0.5, -0.5,
0.5, 0.5, -0.5,
-0.5, 0.5, -0.5,
-0.5, -0.5, 0.5,
0.5, -0.5, 0.5,
0.5, 0.5, 0.5,
-0.5, 0.5, 0.5
-0.5,
-0.5,
-0.5,
0.5,
-0.5,
-0.5,
0.5,
0.5,
-0.5,
-0.5,
0.5,
-0.5,
-0.5,
-0.5,
0.5,
0.5,
-0.5,
0.5,
0.5,
0.5,
0.5,
-0.5,
0.5,
0.5,
]
@pytest.fixture
def cube_faces():
return [
4, 0, 3, 2, 1, # bottom (-z)
4, 4, 5, 6, 7, # top (+z)
4, 0, 1, 5, 4, # front (-y)
4, 3, 7, 6, 2, # back (+y)
4, 0, 4, 7, 3, # left (-x)
4, 1, 2, 6, 5 # right (+x)
4,
0,
3,
2,
1, # bottom (-z)
4,
4,
5,
6,
7, # top (+z)
4,
0,
1,
5,
4, # front (-y)
4,
3,
7,
6,
2, # back (+y)
4,
0,
4,
7,
3, # left (-x)
4,
1,
2,
6,
5, # right (+x)
]
@pytest.fixture
def cube_colors():
return [
255, 0, 0, 255, # red
0, 255, 0, 255, # green
0, 0, 255, 255, # blue
255, 255, 0, 255, # yellow
255, 0, 255, 255, # magenta
0, 255, 255, 255, # cyan
255, 255, 255, 255, # white
0, 0, 0, 255 # black
255,
0,
0,
255, # red
0,
255,
0,
255, # green
0,
0,
255,
255, # blue
255,
255,
0,
255, # yellow
255,
0,
255,
255, # magenta
0,
255,
255,
255, # cyan
255,
255,
255,
255, # white
0,
0,
0,
255, # black
]
@pytest.fixture
def cube_texture_coords():
return [
0.0, 0.0,
1.0, 0.0,
1.0, 1.0,
0.0, 1.0,
0.0, 0.0,
1.0, 0.0,
1.0, 1.0,
0.0, 1.0
0.0,
0.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
1.0,
1.0,
0.0,
1.0,
]
@pytest.fixture
def sample_mesh(cube_vertices, cube_faces):
return Mesh(vertices=cube_vertices, faces=cube_faces, units=Units.m)
@pytest.fixture
def full_mesh(cube_vertices, cube_faces, cube_colors, cube_texture_coords):
return Mesh(
vertices=cube_vertices,
faces=cube_faces,
colors=cube_colors,
textureCoordinates=cube_texture_coords,
units=Units.m
units=Units.m,
)
@@ -101,7 +167,6 @@ def test_mesh_texture_coordinates_count(full_mesh):
def test_mesh_get_point(sample_mesh):
point = sample_mesh.get_point(0)
assert isinstance(point, Point)
assert point.x == -0.5
@@ -142,14 +207,12 @@ def test_mesh_is_closed(sample_mesh):
def test_mesh_area(sample_mesh):
calculated_area = sample_mesh.calculate_area()
sample_mesh.area = calculated_area
assert sample_mesh.area == pytest.approx(6.0)
def test_mesh_volume(sample_mesh):
calculated_volume = sample_mesh.calculate_volume()
sample_mesh.volume = calculated_volume
@@ -158,7 +221,6 @@ def test_mesh_volume(sample_mesh):
def test_mesh_invalid_vertices():
mesh = Mesh(vertices=[0.0, 0.0], faces=[3, 0, 1, 2], units=Units.m)
with pytest.raises(ValueError):
@@ -166,7 +228,6 @@ def test_mesh_invalid_vertices():
def test_mesh_invalid_faces():
vertices = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0]
with pytest.raises(IndexError):
# Face references vertex index out of range
+3 -22
View File
@@ -7,14 +7,12 @@ from specklepy.objects.models.units import Units
@pytest.fixture
def sample_point():
point = Point(x=1.0, y=2.0, z=3.0, units=Units.m)
return point
@pytest.fixture
def sample_vectors():
normal = Vector(x=0.0, y=0.0, z=1.0, units=Units.m)
xdir = Vector(x=1.0, y=0.0, z=0.0, units=Units.m)
ydir = Vector(x=0.0, y=1.0, z=0.0, units=Units.m)
@@ -24,27 +22,17 @@ def sample_vectors():
@pytest.fixture
def sample_plane(sample_point, sample_vectors):
normal, xdir, ydir = sample_vectors
plane = Plane(
origin=sample_point,
normal=normal,
xdir=xdir,
ydir=ydir,
units=Units.m
origin=sample_point, normal=normal, xdir=xdir, ydir=ydir, units=Units.m
)
return plane
def test_plane_creation(sample_point, sample_vectors):
normal, xdir, ydir = sample_vectors
plane = Plane(
origin=sample_point,
normal=normal,
xdir=xdir,
ydir=ydir,
units=Units.m
origin=sample_point, normal=normal, xdir=xdir, ydir=ydir, units=Units.m
)
assert plane.origin == sample_point
@@ -55,14 +43,9 @@ def test_plane_creation(sample_point, sample_vectors):
def test_plane_units(sample_point, sample_vectors):
normal, xdir, ydir = sample_vectors
plane = Plane(
origin=sample_point,
normal=normal,
xdir=xdir,
ydir=ydir,
units=Units.m
origin=sample_point, normal=normal, xdir=xdir, ydir=ydir, units=Units.m
)
assert plane.units == Units.m.value
@@ -72,7 +55,6 @@ def test_plane_units(sample_point, sample_vectors):
def test_plane_invalid_construction():
point = Point(x=1.0, y=2.0, z=3.0, units=Units.m)
normal = Vector(x=0.0, y=0.0, z=1.0, units=Units.m)
xdir = Vector(x=1.0, y=0.0, z=0.0, units=Units.m)
@@ -93,7 +75,6 @@ def test_plane_invalid_construction():
def test_plane_serialization(sample_plane):
serialized = serialize(sample_plane)
deserialized = deserialize(serialized)
+1 -1
View File
@@ -18,7 +18,7 @@ def test_point_distance_calculation():
p2 = Point(x=4.0, y=6.0, z=8.0, units=Units.m)
distance = p1.distance_to(p2)
expected = ((3.0**2 + 4.0**2 + 5.0**2) ** 0.5)
expected = (3.0**2 + 4.0**2 + 5.0**2) ** 0.5
assert distance == pytest.approx(expected)
with pytest.raises(TypeError):
+33 -16
View File
@@ -8,24 +8,40 @@ from specklepy.objects.primitive import Interval
@pytest.fixture
def open_square_coords():
return [
0.0, 0.0, 0.0, # point 1
1.0, 0.0, 0.0, # point 2
1.0, 1.0, 0.0, # point 3
0.0, 1.0, 0.0 # point 4
0.0,
0.0,
0.0, # point 1
1.0,
0.0,
0.0, # point 2
1.0,
1.0,
0.0, # point 3
0.0,
1.0,
0.0, # point 4
]
@pytest.fixture
def closed_square_coords():
return [
0.0, 0.0, 0.0, # point 1
1.0, 0.0, 0.0, # point 2
1.0, 1.0, 0.0, # point 3
0.0, 1.0, 0.0, # point 4
0.0, 0.0, 0.0 # point 5 (same as point 1)
0.0,
0.0,
0.0, # point 1
1.0,
0.0,
0.0, # point 2
1.0,
1.0,
0.0, # point 3
0.0,
1.0,
0.0, # point 4
0.0,
0.0,
0.0, # point 5 (same as point 1)
]
@@ -55,9 +71,11 @@ def test_polyline_is_closed(open_square_coords, closed_square_coords):
def test_polyline_is_closed_with_tolerance(open_square_coords):
almost_closed = open_square_coords + \
[0.0, 0.0, 0.001] # last point slightly above start
almost_closed = open_square_coords + [
0.0,
0.0,
0.001,
] # last point slightly above start
poly = Polyline(value=almost_closed, units=Units.m)
assert not poly.is_closed(tolerance=1e-6)
@@ -87,7 +105,7 @@ def test_polyline_get_points(sample_polyline):
Point(x=0.0, y=0.0, z=0.0, units=Units.m),
Point(x=1.0, y=0.0, z=0.0, units=Units.m),
Point(x=1.0, y=1.0, z=0.0, units=Units.m),
Point(x=0.0, y=1.0, z=0.0, units=Units.m)
Point(x=0.0, y=1.0, z=0.0, units=Units.m),
]
# Check coordinates match
@@ -98,7 +116,6 @@ def test_polyline_get_points(sample_polyline):
def test_polyline_invalid_coordinates():
invalid_coords = [0.0, 0.0, 0.0, 1.0, 1.0] # missing one coordinate
with pytest.raises(ValueError):
polyline = Polyline(value=invalid_coords, units=Units.m)
+4 -5
View File
@@ -12,10 +12,11 @@ from specklepy.core.api.inputs.version_inputs import CreateVersionInput
from specklepy.core.api.models import Stream, Version
from specklepy.logging import metrics
from specklepy.objects.base import Base
from .fakemesh import FakeMesh, FakeDirection
from specklepy.objects.geometry import Point
from specklepy.transports.server.server import ServerTransport
from .fakemesh import FakeDirection, FakeMesh
metrics.disable()
@@ -44,8 +45,7 @@ def seed_user(host: str) -> Dict[str, str]:
if not r.ok:
raise Exception(f"Cannot seed user: {r.reason}")
redirect_url = urlparse(r.headers.get("location"))
access_code = parse_qs(redirect_url.query)[
"access_code"][0] # type: ignore
access_code = parse_qs(redirect_url.query)["access_code"][0] # type: ignore
r_tokens = requests.post(
url=f"http://{host}/auth/token",
@@ -114,8 +114,7 @@ def sample_stream(client: SpeckleClient) -> Stream:
description="a stream created for testing",
isPublic=True,
)
stream.id = client.stream.create(
stream.name, stream.description, stream.isPublic)
stream.id = client.stream.create(stream.name, stream.description, stream.isPublic)
return stream
+1 -2
View File
@@ -1,9 +1,8 @@
from enum import Enum
from typing import List, Optional
from specklepy.objects.geometry import Point
from specklepy.objects.base import Base
from specklepy.objects.geometry import Point
CHUNKABLE_PROPS = {
"vertices": 100,
+2 -1
View File
@@ -4,11 +4,12 @@ import pytest
from specklepy.api import operations
from specklepy.objects.base import Base
from .fakemesh import FakeMesh
from specklepy.objects.geometry import Point
from specklepy.transports.memory import MemoryTransport
from specklepy.transports.server import ServerTransport
from .fakemesh import FakeMesh
@pytest.mark.run(order=5)
class TestSerialization:
+1 -2
View File
@@ -100,7 +100,6 @@ class GraphTraversalTests(TestCase):
for context in GraphTraversal([traverse_lists_rule]).traverse(test_case)
]
self.assertCountEqual(
ret, [test_case, expected_traverse, expected_traverse])
self.assertCountEqual(ret, [test_case, expected_traverse, expected_traverse])
self.assertNotIn(expected_ignore, ret)
self.assertEqual(len(ret), 3)
+3 -6
View File
@@ -87,8 +87,7 @@ fake_bases = [FakeBase("foo"), FakeBase("bar")]
(Tuple, (1, "foo", "bar"), True, (1, "foo", "bar")),
# given our current rules, this is the reality. Its just sad...
(Tuple[str, str, str], (1, "foo", "bar"), True, ("1", "foo", "bar")),
(Tuple[str, Optional[str], str],
(1, None, "bar"), True, ("1", None, "bar")),
(Tuple[str, Optional[str], str], (1, None, "bar"), True, ("1", None, "bar")),
(Set[bool], set([1, 2]), False, set([1, 2])),
(Set[int], set([1, 2]), True, set([1, 2])),
(Set[int], set([None, 2]), True, set([None, 2])),
@@ -100,8 +99,7 @@ fake_bases = [FakeBase("foo"), FakeBase("bar")]
(Optional[Union[List[int], List[FakeBase]]], None, True, None),
(Optional[Union[List[int], List[FakeBase]]], "foo", False, "foo"),
(Union[List[int], List[FakeBase], None], "foo", False, "foo"),
(Optional[Union[List[int], List[FakeBase]]],
[1, 2, 3], True, [1, 2, 3]),
(Optional[Union[List[int], List[FakeBase]]], [1, 2, 3], True, [1, 2, 3]),
(
Optional[Union[List[int], List[FakeBase]]],
fake_bases,
@@ -115,8 +113,7 @@ fake_bases = [FakeBase("foo"), FakeBase("bar")]
True,
{"foo": 1.0, "bar": 2.0},
),
(Union[float, Dict[str, float]], {
"foo": "bar"}, False, {"foo": "bar"}),
(Union[float, Dict[str, float]], {"foo": "bar"}, False, {"foo": "bar"}),
],
)
def test_validate_type(