Skip to main content

pytest se tests likhna

pytest se unit tests likh paoge, fixtures aur parametrised tests use kar paoge, slow ya external parts ko fake kar paoge, aur pata hoga ki sabse pehle kya test karna hai.

Beginner 3 · Data and toolsabout 2 hours5 sections

Seedha jawab

Test aisa code hai jo aapke code ko ek known input ke saath chalata hai aur output check karta hai. pytest test_ naam ke functions dhundhta hai aur batata hai kaunse pass hue, taaki aap code badalte waqt jaan sako ki kuch toota nahi.

Ye kyun zaroori hai

Tests aapko bina darr ke code badalne dete hain, users se pehle bugs pakadte hain, aur reviewers ko dikhate hain ki aapka change kaam karta hai. Interviewers poochte hain ki aap test kaise karte ho, aur AI teams apne code ke saath apne prompts ko bhi test karti hain.

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.