Start Testing Your Python with doctest & Pagination in Django | Real Python Podcast #109

preview_player
Показать описание
Did you know you can add testing to your Python code while simultaneously documenting it? Using doc-strings, you can create examples of how your functions should interact in a Python REPL and test them with the built-in doctest module. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder's Weekly articles and projects.

Christopher shares an article by previous guest Mike Driscoll about testing with doctest. This is a great way to get started with testing your own code, and it offers the added benefit of documenting functionality.

We talk about a recent Real Python article titled "Pagination for a User-Friendly Django App". Spreading your content across multiple pages can significantly improve the user experience of your web application. This article takes you through configuring Django's built-in pagination tool and how to combine it with other web tools.

We discuss a recent article about Python type hints and the author's disappointment. We also include reactions from a couple of online communities.

We cover several other articles and projects from the Python community, including why it's important to close files in Python, how dunder methods are awesome, a bidirectional Python dictionary, prettier git diffs, and a command-line game to learn git.

Topics:

- 00:00:00 -- Introduction
- 00:02:15 -- PyCon US 2022 Follow-up
- 00:07:57 -- Why Is It Important to Close Files in Python?
- 00:15:17 -- Dunder Methods in Python: The Ugliest Awesome Sauce
- 00:24:26 -- Sponsor: Mailtrap
- 00:25:08 -- Python Testing With doctest
- 00:28:20 -- Python Bidirectional Dictionary
- 00:30:27 -- Pagination for a User-Friendly Django App
- 00:36:07 -- Video Course Spotlight
- 00:37:27 -- Python’s “Type Hints” are a bit of a disappointment to me
- 00:52:25 -- dunk: Prettier Git Diffs
- 00:53:43 -- git-gud: Command-Line Game to Learn git
- 00:55:40 -- Thanks and goodbye

Рекомендации по теме