mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-28 16:04:35 +02:00
fix the cell pydantic cause the program was too long
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
from pydantic import BaseModel, Field
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
class Cell(BaseModel):
|
@dataclass
|
||||||
value: int = Field(ge=0, le=15)
|
class Cell:
|
||||||
|
def __init__(self, value: int) -> None:
|
||||||
|
self.value = value
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return hex(self.value).removeprefix("0x").upper()
|
return hex(self.value).removeprefix("0x").upper()
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
import numpy
|
import numpy
|
||||||
from amaz_lib.MazeGenerator import DepthFirstSearch
|
from amaz_lib.MazeGenerator import DepthFirstSearch
|
||||||
from amaz_lib.MazeGenerator import Kruskal
|
|
||||||
|
|
||||||
|
|
||||||
class TestMazeGenerator:
|
class TestMazeGenerator:
|
||||||
|
|
||||||
def test_kruskal_output_shape() -> None:
|
def test_generator(self) -> None:
|
||||||
generator = Kruskal().generator(10, 10)
|
w_h = (300, 300)
|
||||||
maze = numpy.array([])
|
maze = numpy.array([])
|
||||||
|
generator = DepthFirstSearch().generator(*w_h)
|
||||||
for output in generator:
|
for output in generator:
|
||||||
maze = output
|
maze = output
|
||||||
|
|
||||||
assert maze.shape == (10, 10)
|
assert maze.shape == w_h
|
||||||
|
|
||||||
def test_generator(self) -> None:
|
|
||||||
maze = numpy.array([])
|
|
||||||
maze = DepthFirstSearch.generator(10, 10)
|
|
||||||
assert maze.shape == (10, 10)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user