
Meliowant
Python Testing with pytest, Second Edition: example with complex -k argument contains tests not mentioned previously (page 28)
There is the following example, on the page 28:
$ pytest -v --tb=no -k “(dict or ids) and not TestEquality”
=========================== test session starts ===========================
collected 24 items / 18 deselected / 6 selected
test_card.py::test_equality_with_diff_ids PASSED [ 16%]
test_card.py::test_from_dict PASSED [ 33%]
test_card.py::test_to_dict PASSED [ 50%]
test_classes.py::test_from_dict PASSED [ 66%]
test_classes.py::test_to_dict PASSED [ 83%]
test_structure.py::test_to_dict PASSED [100%]
==================== 6 passed, 18 deselected in 0.08s ====================
But tests test_from_dict()
and test_to_dict()
are missing (or at least were not mentioned) in the test_classes.py
before that page. And this confuses.
I see that tests are in the source code that accompanies the book, so maybe these tests will be added to the test_classes.py
later, but at the page 28 they don’t exist in the file.
Thus the example should be something like:
$ pytest -v --tb=no -k “(ids or dict) and not TestEqual”
============================ test session starts =============================
collected 19 items / 15 deselected / 4 selected
test_card.py::test_equality_with_diff_ids PASSED [ 25%]
test_card.py::test_from_dict PASSED [ 50%]
test_card.py::test_to_dict PASSED [ 75%]
test_structure.py::test_to_dict PASSED [100%]
====================== 4 passed, 15 deselected in 0.18s ======================
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /react-native
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /js
- /swift
- /deno
- /tailwind
- /assemblyscript
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /nim
- /vuejs
- /emacs
- /elm
- /nerves