adicionar teste para metodo '__str__()'

This commit is contained in:
2026-04-07 10:16:20 +01:00
parent 53efc9077e
commit 26733e44bd

View File

@ -1,7 +1,7 @@
import pytest import pytest
from random import randint from random import randint
from modules.agente import Agente from modules.agente import Agente
from modules.mapa import Mapa, MAX_DIMENSAO, MIN_DIMENSAO from modules.mapa import Mapa, MIN_DIMENSAO
class Test_Mapa: class Test_Mapa:
@ -38,3 +38,14 @@ class Test_Mapa:
if pos_y >= mapa.dimensao[0]: if pos_y >= mapa.dimensao[0]:
pos_y = 0 pos_y = 0
assert agente is mapa.mundo[pos_x][pos_y] assert agente is mapa.mundo[pos_x][pos_y]
def test_stringify(self):
"""
teste para metodo __str__()
"""
mapa: Mapa = Mapa((16, 16))
assert (
mapa.__str__()
== f"Dados Mapa ({mapa.id_mapa})\n \
\tdimensao: {mapa.dimensao[0]} x {mapa.dimensao[1]}"
)