Skip to main content

pytest से tests लिखना

pytest से unit tests लिख पाओगे, fixtures और parametrised tests use करना, धीमे या बाहरी हिस्सों को fake करना, और ये जानना कि पहले क्या test करना है।

Beginner 3 · Data and toolsabout 2 hours5 sections

सीधा जवाब

Test वो code है जो आपके code को जाने-पहचाने input के साथ चलाकर output check करता है। pytest test_ नाम वाले functions ढूँढता है और बताता है कि कौन pass हुए, ताकि आप code बदलते हुए जानो कि कुछ टूटा नहीं।

ये क्यों ज़रूरी है

Tests से आप बिना डर के code बदल सकते हो, users से पहले bugs पकड़ सकते हो, और reviewers को दिखा सकते हो कि आपका change काम करता है। Interviewers पूछते हैं कि आप test कैसे करते हो, और AI teams अपने code और prompts, दोनों को test करती हैं।

Sign up free to read the whole lesson

The rest of this lesson: 5 parts, video lessons, the best course, practice and a quick check. It is free, takes a few seconds and needs no card.

Accounts are for learners aged 18 and over. Under 18? The quick answer and the first part of every lesson stay open: browse lessons by topic.

Software engineeringBeginner 3: Data and toolsUnit testpytestTest fixtureMocking

Track

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.