Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Errore Es2 Hw3

p
pietrobrega (4460 points)
6 13 42
in Es2 by (4.5k points)

Riguardo al test:          test_20b_Skyline_1___s1____verde__ 

mi viene restituito un errore:    

colore = 'verde'

    @data(  ['s1', 'verde'],
            ['s2', 'rosso'],
            ['s3', 'blu'  ],
            )
    @unpack
    def test_20b_Skyline(self, nome, colore):
        '''tenta di creare skyline con parametri corretti'''
>       c = getattr(self, colore)
E       AttributeError: 'Test' object has no attribute 'verde'

test_02.py:161: AttributeError

Non riesco a capire cosa voglia dire...qualcuno ha delle idee???

505 views
closed

3 Answers

Best answer
a
alex_err (5800 points)
1 3 32
by (5.8k points)
selected by

Confermo quello che hanno detto anche gli altri... ti suggerisco, per quando esegui i test, di utilizzare il comando pytest -v -x test_0X.py. Aggiungendo "-x" come parametro permette di bloccare i test non appena viene rilevato un qualsiasi errore.

andrea.sterbini (207940 points)
756 1270 2377
by (208k points)
ottima idea, grazie per il suggerimento
andrea.sterbini (207940 points)
756 1270 2377
by (208k points)
In questo esercizio alcuni test costruiscono i dati per i test seguenti, per cui se falliscono falliscono anche i test seguenti.

Questo errore deriva dal fatto che in un passaggio precedente non è stato costruito il colore verde.
_andrea_ (45670 points)
13 42 297
by (45.7k points)
ci sono altri test che fallisci prima di quello?
p
pietrobrega (4460 points)
6 13 42
by (4.5k points)
Il fatto è che sapevo del fatto che dice il professore...prima di questo non ho altri errori