PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
Chat - (gpt-5.6)
Token size
221
Example input
[Paste your function with its docstring here]: def calculate_discount(price, discount_pct, min_price=0): if discount_pct less than 0 or discount_pct greater than 100: raise ValueError(...); discounted = price times (1 minus discount_pct divided by 100); return max(discounted, min_price) [What should the tests cover? Happy path, edge cases, error handling]: Cover happy path, edge cases with zero and boundary values, and error cases for invalid discount percentages [Any mocking needed, external dependencies, specific edge cases to test]: No external dependencies, pure function with math logic
Example output
Here is a pytest test suite covering happy paths and edge cases. import pytest from discount import calculate_discount test_data = ( (100, 10, 0, 90), (50, 20, 0, 40), (100, 0, 0, 100), (100, 100, 0, 0), (0, 50, 0, 0), ) @pytest.mark.parametrize("price,discount,min_price,expected", test_data) def test_discount_returns_correct_price(price, discount, min_price, expected): assert calculate_discount(price, discount, min_price) == expected min_price_data = ((100, 50, 60, 60), (100, 10, 95, 95)) @pytest.mark.parametrize("price,discount,min_price,expected", min_price_data) def test_discount_respects_minimum_price(price, discount, min_price, expected): assert calculate_discount(price, discount, min_price) == expected Tests use parametrize for compact, readable checks. Descriptive names make failures easy to understand.
🤖 GPT

Python Unit Test Generator Pytest

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Tested icon
Guide icon
4 examples icon
Free credits icon
Paste any Python function. Get a complete pytest suite: happy paths, edge cases, error handling. Parametrized, clean, with descriptive names. Handles mocking. Ready to run. Launch: $2.99 (normally $4.99). Works with ChatGPT, Claude, Gemini.
...more
Added over 1 month ago
Report
Browse Marketplace