
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
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /c
- /julia
- /neovim