Add dtype testing for data_equivalence and update testing (#515)

This commit is contained in:
Mark Towers
2023-05-23 17:03:25 +01:00
committed by GitHub
parent 5bf6c1e93f
commit ae5d8888aa
5 changed files with 57 additions and 28 deletions

View File

@@ -256,7 +256,7 @@ class Box(Space[NDArray[Any]]):
def from_jsonable(self, sample_n: Sequence[float | int]) -> list[NDArray[Any]]:
"""Convert a JSONable data type to a batch of samples from this space."""
return [np.asarray(sample) for sample in sample_n]
return [np.asarray(sample, dtype=self.dtype) for sample in sample_n]
def __repr__(self) -> str:
"""A string representation of this space.