menu_book Course Curriculum (Software Testing) expand_more
Testing Fundamentals
Assertions & Fixtures
Test Doubles & Dependencies
Coverage & Quality
API & Web Testing
unit test isolation
Learn unit test isolation in Software Testing with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.
12 min read
•
Beginner
software-testing-002.py
python
class PriceService:
def total(self, repo, sku): return repo.price(sku)*2
class FakeRepo:
def price(self, sku): return 9
def test_total_isolated_from_db():
assert PriceService().total(FakeRepo(),'A1') == 18
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content