Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,965 guides across 14 topics

Topics

Latest guides

A visual metaphor of a Python Faker data generator with a globe, a unique stamp, and a seed icon, representing locale, uniqueness, and determinism.
Python

Python Faker: Locale, Unique Values, and Seeds

Learn how Python Faker combines locale-specific data, deterministic seeds, and unique value generation for realistic test data, along with common pitfalls.

Fakertest datalocalesrandomness
Illustration of a Python Faker generator producing realistic names, emails, addresses, and dates from a code block.
Python

Generate Names, Emails, Addresses, and Dates with Python Faker

Learn how to use Python Faker to generate realistic names, emails, addresses, and dates for test data. Includes locale support, reproducible seeds, and performance tips.

FakerPythonfake datatest data
A visual metaphor for pytest coverage configuration, showing a shield with a coverage percentage gauge and a Python code snippet in the background.
Python

Python Pytest Cov Configuration and Coverage Reports

python pytest cov configuration and coverage reports: Learn how to configure pytest-cov, generate terminal, HTML, and XML coverage reports, and enforce coverage thresh...

pytestcoveragepytest-covtesting
Illustration of Python code with branch coverage report showing covered and missed branches in an HTML view.
Python

Python Coverage: Branch Coverage and HTML Reports

Learn how to measure branch coverage with Python's coverage.py, generate HTML reports, and interpret missed branches.

coverage.pybranch coverageHTML reportstesting
Illustration of a custom Hypothesis strategy generating test data for a pytest test, showing a composite of data shapes and a test runner.
Python

Python Hypothesis Custom Strategies with Pytest

Learn to define custom Hypothesis strategies for property-based testing and use them with pytest, covering @composite, .map, and .filter.

Hypothesispytestproperty-based testingcustom strategies
Illustration of Python Hypothesis strategies generating numbers, strings, and lists for property-based testing.
Python

Python Hypothesis Strategies for Numbers, Strings, and Lists

python hypothesis strategies for numbers strings and lists: Use Hypothesis strategies for numbers, strings, and lists to generate diverse test inputs and catch edge ca...

HypothesisProperty-Based TestingPython TestingData Generation
Illustration of property-based testing with Python Hypothesis showing generated inputs and a shrinking failure.
Python

Python Hypothesis Property-Based Testing Basics

Learn how to write property-based tests in Python with Hypothesis: describe invariants, generate inputs with strategies, build composite data, and debug failures through shrinking.

property-based testinghypothesispython testingtest strategies
A stylized diagram showing a pytest test intercepting an HTTP request with a mock response, with a network cable cut symbolizing no real API call.
Python

Mocking API Requests in pytest with Python

Learn how to mock API requests in pytest using unittest.mock and monkeypatch. Simulate responses and errors, verify request arguments, and keep tests fast and deterministic.

pytestmockingrequestsunit testing
An illustration of a Python unit test replacing a function with a spy that records calls while the original logic continues to run.
Python

Python Pytest Mocker: Patch, Spy, and Call Assertions

Use pytest-mock's mocker fixture to patch dependencies, spy on real functions, and assert calls reliably in Python unit tests.

pytestpytest-mockunit testingmocking
Diagram showing a Python pytest mock replacing a real function with a controllable return value and side effect.
Python

Python Pytest Mock: Functions, Classes, Return Values, Side Effects

Learn to mock functions and classes in Python pytest with unittest.mock: set return values, define side effects, patch classes, verify calls, and test async code.

pytestmockingunit testingunittest.mock