1000 Python Examples by Gábor Szabó
$14
$20.86
Description Fixtures and Mocking in Python How do you test Moon-landing? How do you test a system … Plan About me Goal Fixtures Fixtuers in Pytest Traditional xUnit fixtures Dependency Injection Temporary directory – tmpdir Capture STDOUT and STDERR – capsys Home-made fixture Home-made fixture – conftest Home-made fixture with tempdir Home-made fixture with yield Fixture Autouse Fixture Autouse with yield Fixture for MongoDB Test Doubles Test Doubles explained Verify behavior or state? What is Mocking and Monkey Patching? Situations Unit testing vs. Integration testing Experiment with mocking in various situations Examples are simple Hard coded path Manually Patching attribute Monkey Patching attribute Monkey Patching functions Monkey Patching dictionary items Mocking a whole class Mocking input/output Mocking input/output Mocking random numbers Exercises Work in pairs Exercise: test login expiration Solution: test login expiration Exercise: Record e-mail sending Solution: Record e-mail sending Exercise: Fixture database Exercise: One Dimentsional space-fight Exercise: web client Exercise: Open WeatherMap client Exercise: Mocking A Bank Testing the whole application Resources Retrospective Job searching help Solutions – game Solutions – Mocking the database access First steps What is Python? What is needed to write a program? The source (code) of Python Python 2 vs. Python 3 Installation Installation on Linux Installation on Apple Mac OSX Installation on MS Windows Editors, IDEs Documentation Program types Python on the command line First script – hello world Examples Comments Variables Exercise: Hello world What is programming? What are the programming languages A written human language A programming language Words and punctuation matter! Literals, Value Types in Python Floating point limitation Value Types in Numpy Rectangle (numerical operations) Multiply string Add numbers Add strings Exercise: Calculations Solution: Calculations
Programming Languages