GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Teste de lançamento de pássaros · pythonprobr/pythonbirds@b8edd43

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • fase.py
  • testes
    • fase_testes.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎fase.py‎

Copy file name to clipboardExpand all lines: fase.py
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
from atores import ATIVO
22

33

4+
class Ponto():
5+
def __init__(self, x, y, caracter):
6+
self.caracter = caracter
7+
self.x = x
8+
self.y = y
9+
10+
def __eq__(self, other):
11+
return self.x == other.x and self.y == other.y and self.caracter == other.caracter
12+
13+
414
class Fase():
515
def __init__(self):
616
self._passaros = []
@@ -19,7 +29,7 @@ def adicionar_passaro(self, *passaros):
1929
def acabou(self, tempo):
2030
return not self._existe_porco_ativo(tempo) or not self._existe_passaro_ativo(tempo)
2131

22-
def status(self,tempo):
32+
def status(self, tempo):
2333
if self._existe_passaro_ativo(tempo):
2434
return 'Jogo em andamento.'
2535
if self._existe_porco_ativo(tempo):
@@ -36,6 +46,6 @@ def _verificar_se_existe_ator_ativo(self, atores, tempo):
3646
return False
3747

3848
def _existe_passaro_ativo(self, tempo):
39-
return self._verificar_se_existe_ator_ativo(self._passaros,tempo)
49+
return self._verificar_se_existe_ator_ativo(self._passaros, tempo)
4050

4151

Collapse file

‎testes/fase_testes.py‎

Copy file name to clipboardExpand all lines: testes/fase_testes.py
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,25 @@ def teste_status(self):
100100
self.assertEqual('Jogo em andamento.', fase.status(3),
101101
'Com Porco ativo e com pássaro para lançar, o jogo não deveria acabar')
102102

103+
def teste_lancar_passaro_sem_erro_quando_nao_existe_passaro(self):
104+
fase = Fase()
105+
fase.lancar(90, 0)
106+
107+
def teste_lancar_passaro_sem_erro_quando_nao_existe_passaro(self):
108+
passaro_vermelho, passaro_amarelo = PassaroVermelho(1, 1), PassaroAmarelo(1, 1)
109+
fase = Fase(passaro_vermelho, passaro_amarelo)
110+
fase.lancar(90, 1)
111+
fase.lancar(45, 3)
112+
fase.lancar(31, 5) # testando que lançar passaros depos de todos lançados não causa erro
113+
self.assertEqual(90, passaro_vermelho._angulo_de_lancamento)
114+
self.assertEqual(1, passaro_vermelho._tempo_de_lancamento)
115+
116+
self.assertEqual(45, passaro_amarelo._angulo_de_lancamento)
117+
self.assertEqual(3, passaro_amarelo._tempo_de_lancamento)
118+
119+
120+
# def teste_calcular_pontos(self):
121+
# fase=Fase()
122+
# self.assertListEqual([],fase.calcular)
123+
103124

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.