nose-parameterized

Software screenshot:
nose-parameterized
Dettagli del software:
Versione: 0.3.1
Data di caricamento: 14 Apr 15
Sviluppatore: David Wolever
Licenza: Libero
Popolarità: 3

Rating: 3.0/5 (Total Votes: 1)

naso-patameterized è un decoratore per il test con parametri con il naso.
Naso. E 'ottenuto generatori di prova. Ma che tipo di schifo, perché:
- Spesso Richiedono una seconda funzione
- Si rendono difficile separare i dati dal test
- Non funzionano con subclases di unittest.TestCase
Ma correzioni che naso-parametrizzato.
Controlla:
 cat test_math.py
da nose.tools import assert_equal
dall'importazione nose_parameterized parametrizzato
import unittest
import math
parameterized ([
& Nbsp; (2, 2, 4),
& Nbsp; (2, 3, 8),
& Nbsp; (1, 9, 1),
& Nbsp; (0, 9, 0),
])
def test_pow (base, esponente, atteso):
& Nbsp; assert_equal (Math.pow (base, esponente), atteso)
Classe TestMathUnitTest (unittest.TestCase):
& Nbsp; @ parameterized.expand ([
& Nbsp; (- 1.5, -2.0),
& Nbsp; (1.0, 1.0),
& Nbsp; (1,6, 1),
& Nbsp;])
& Nbsp; def test_floor (self, ingresso, previsto):
& Nbsp; assert_equal (Math.floor (input), atteso)
$ Nosetests -v test_math.py
test_math.test_pow (2, 2, 4) ... ok
test_math.test_pow (2, 3, 8) ... ok
test_math.test_pow (1, 9, 1) ... ok
test_math.test_pow (0, 9, 0) ... ok
test_floor_0 (test_math.TestMathUnitTest) ... ok
test_floor_1 (test_math.TestMathUnitTest) ... ok
test_floor_2 (test_math.TestMathUnitTest) ... ok
-------------------------------------------------- --------------------
Ran 7 prove in 0.002s
OK

Requisiti :

  • Python
  • naso

Programmi simili

ReviewBoard
ReviewBoard

19 Feb 15

Tarn
Tarn

14 Apr 15

Jensor
Jensor

2 Jun 15

MPI-IO Test
MPI-IO Test

2 Jun 15

Commenti a nose-parameterized

I commenti non trovato
Aggiungi commento
Accendere le immagini!