← Înapoi la Urmăritori

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 8
  1. How to assert exception message in PyTest?

    I kept forgetting how to assert exception messages in PyTest, so I finally checked the docs.

  2. 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.

  3. 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.

  4. 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?

  5. How to parametrize exception testing in PyTest?

    Sometimes it’s useful to provide different input data and test different exceptions being raised.

  6. How to reuse Pydantic model_validator across multiple models without boilerplate code?

    Recently I’ve been working with Pydantic models quite a lot.

  7. 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.

  8. »> print(“Hello World!”)

    Hi there!