From c478400640364976d4f3c07fbf56051703e7d4b2 Mon Sep 17 00:00:00 2001 From: Maoake Teriierooiterai Date: Tue, 24 Mar 2026 15:34:43 +0100 Subject: [PATCH] fix the cell pydantic cause the program was too long --- src/amaz_lib/Cell.py | 8 +++++--- tests/test_MazeGenerator.py | 13 ++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/amaz_lib/Cell.py b/src/amaz_lib/Cell.py index 56f0c61..cc205ab 100644 --- a/src/amaz_lib/Cell.py +++ b/src/amaz_lib/Cell.py @@ -1,8 +1,10 @@ -from pydantic import BaseModel, Field +from dataclasses import dataclass -class Cell(BaseModel): - value: int = Field(ge=0, le=15) +@dataclass +class Cell: + def __init__(self, value: int) -> None: + self.value = value def __str__(self) -> str: return hex(self.value).removeprefix("0x").upper() diff --git a/tests/test_MazeGenerator.py b/tests/test_MazeGenerator.py index 1c1e868..948748a 100644 --- a/tests/test_MazeGenerator.py +++ b/tests/test_MazeGenerator.py @@ -1,19 +1,14 @@ import numpy from amaz_lib.MazeGenerator import DepthFirstSearch -from amaz_lib.MazeGenerator import Kruskal class TestMazeGenerator: - def test_kruskal_output_shape() -> None: - generator = Kruskal().generator(10, 10) + def test_generator(self) -> None: + w_h = (300, 300) maze = numpy.array([]) + generator = DepthFirstSearch().generator(*w_h) for output in generator: maze = output - assert maze.shape == (10, 10) - - def test_generator(self) -> None: - maze = numpy.array([]) - maze = DepthFirstSearch.generator(10, 10) - assert maze.shape == (10, 10) + assert maze.shape == w_h