Creează un cont pentru a te abona la acest blog și a-i urmări articolele pe pagina Lectură.
-
How to assert exception message in PyTest?
I kept forgetting how to assert exception messages in PyTest, so I finally checked the docs.
-
How to use overloaded signatures in Python?
Sometimes a function takes multiple arguments of different types, and the return type depends on specific combinations of inputs.
-
How to dump Django ORM data to JSON while debugging?
Sometimes, I need to debug specific high-level tests by inspecting what gets created in the database as a side effect.
-
Why using [n] on a Django QuerySet can be unsafe?
What if I told you that the following way of taking the second object from a Django QuerySet might be unreliable and can lead to non-deterministic failures under some circumstances?
-
How to parametrize exception testing in PyTest?
Sometimes it’s useful to provide different input data and test different exceptions being raised.
-
How to reuse Pydantic model_validator across multiple models without boilerplate code?
Recently I’ve been working with Pydantic models quite a lot.
-
How to check whether Python script has elevated privileges?
It may happen that a Python script needs root privileges on Linux / macOS or admin privileges on Windows to run properly.
-
»> print(“Hello World!”)
Hi there!