freezegunEasy Examples

Mock datetime for testing time-dependent code

Getting started with freezegun

Installation and basic usage of freezegun.

python
# Install: pip install freezegun
import freezegun

# Basic freezegun usage
print(f"Using freezegun")
# See documentation for detailed examples
Expected Output
# Expected output shown below
# (Run locally with: freezegun)

freezegun is a third-party package. Mock datetime for testing time-dependent code. Install with: pip install freezegun

Common freezegun operations

Frequently used features of freezegun.

python
# Install: pip install freezegun
import freezegun

# Common freezegun patterns
print(f"freezegun version: {freezegun.__version__}")

These are the most commonly used features of freezegun in everyday development.

Want to try these examples interactively?

Open Easy Playground