Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Python Object-Oriented Programming
  • Table Of Contents Toc
Python Object-Oriented Programming

Python Object-Oriented Programming - Fourth Edition

By : Steven F. Lott, Dusty Phillips
3.9 (34)
close
close
Python Object-Oriented Programming

Python Object-Oriented Programming

3.9 (34)
By: Steven F. Lott, Dusty Phillips

Overview of this book

Python Object-Oriented Programming, Fourth Edition is a practical guide to advancing your OOP skills with modern Python. Going beyond the fundamentals, it helps you work with Python as an OOP language, explore both common and advanced design patterns, and apply these concepts to data manipulation and testing of complex OOP systems. Each chapter features newly written open-ended exercises as well as a real-world case study, aligned with the improvements in Python 3.11—bringing faster execution and memory efficiency to your applications. Authors Steven F. Lott and Dusty Phillips provide a comprehensive, illustrative tour of important OOP concepts, such as inheritance, composition, and polymorphism, showing how they integrate with Python’s classes and data structures to facilitate good design. The book also introduces two powerful automated testing systems, unittest and pytest, and explores Python's concurrent programming ecosystem in depth. By the end of the book, you’ll have a thorough understanding of how to think about and apply object-oriented principles using Python syntax to create robust and reliable programs.
Table of Contents (17 chapters)
close
close
15
Other Books You May Enjoy
16
Index

Imitating objects using Mocks

Isolated problems are easier to diagnose and solve. Figuring out why a gasoline car won't start can be tricky because there are so many interrelated parts. If a test fails, uncovering all the interrelationships makes diagnosis of the problem difficult. We often want to isolate items by providing simplified imitations. It turns out there are two reasons to replace perfectly good code with imitation (or "mock") objects:

  • The most common case is to isolate a unit under test. We want to create collaborating classes and functions so we can test one unknown component in an environment of known, trusted test fixtures.
  • Sometimes, we want to test code that requires an object that is either expensive or risky to use. Things like shared databases, filesystems, and cloud infrastructures can be very expensive to set up and tear down for testing.

In some cases, this may lead to designing an API to have a testable interface. Designing...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Python Object-Oriented Programming
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon