PySeqTest ⚡️
O PySeqTest foi criado pensando em testes em sequência, executando os testes um a um. Esse tipo de teste é útil quando testamos algo que envolve arquivos, banco de dados, conexões a rede, etc. O objetivo do pyseqtest é ser simples, com verificações de valores boleanos, comparações e exceções.
Exemplo de uso
Vamos começar a utilizar o PySeqTest! Neste primeiro exemplo, faremos o teste de uma simples calculadora. Veja o código:
import pyseqtest
class TestCalculator(pyseqtest.SeqTest):
def __init__(self):
super().__init__()
def test_sum(self):
condition = (10 + 5) == 15
self.is_true(condition)
def test_multiplication(self):
condition = (2 * 5) == 4
self.is_false(condition)
def test_division(self):
# error demonstration
condition = (10 / 2) == 90
self.is_true(condition, msg_error='Oh, the result is wrong')
if __name__ == '__main__':
TestCalculator().run()
No código acima, utilizamos os os seguintes métodos do pyseqtest:
is_true: Verifica se o valor é verdadeiro;
is_false: Verifica se o valor é falso.
Em todos os métodos que verificam o resultado, podemos especificar, opcionalmente, uma mensagem de erro caso o resultado não seja o esperado.
Após executar o teste, o resultado será:
PySeqTest ========= 3 testes presentes. 0:00:00.000018: test_sum 0:00:00.000009: test_multiplication ============================== [ ERROR ] test_division: Oh, the result is wrong
Todos os métodos para afirmação de teste
is_true: Verifica se o valor é verdadeiro;
is_false: Verifica se o valor é falso;
is_none: Verifica se o valor None;
check_any_value: Verifica se o valor de entrada e igual ao valor esperado.
Utilizando check_any_value
O check_any_value é utilizado para verificar dois valores: o valor de entrada, e o valor de saída esperado. Veja um exemplo:
import pyseqtest
class TestCalculator(pyseqtest.SeqTest):
def __init__(self):
super().__init__()
def test_sum(self):
# em vez de:
condition = (10 + 5) == 10
self.is_true(condition)
# podemos fazer assim:
self.check_any_value(15, 10)
# o primeiro parâmetro é o valor
# de entrada, o segundo, é valor
# de saída esperado.
Neste exemplo, um erro seria retornado, já que 15 não é igual a 10.
Metadata
Release files for PySeqTest 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PySeqTest-1.0.2.tar.gz | 3.4 kB | Without provenance | Details for PySeqTest-1.0.2.tar.gz |
Release files / PySeqTest-1.0.2.tar.gz
| Download URL | PySeqTest-1.0.2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e8507f18f31407893a880d3ec83c4de31e6c043b7b3847d2382b828f0ea8a21
|
|
BLAKE2b-256 checksum How to use checksums |
bb94c828c34dfadef56b9feccab535c6250a3e286772463350f08090cfd41b66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for PySeqTest 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.