Learn how to use the pytest framework to write tests and execute them. You can talk about how to write tests and how to set your environment for running tests.
- [Instructor] Python has a test suite built in.…However, I prefer to use pytest,…which is very popular, more Pythonic,…and packed with features.…Let's try an example.…Create a directory for tests.…Tests should never make it into production.…More than one companies suffered from tests…running in production, deleting production databases,…and causing havoc.…So we'll make a directory tests.…Let's write a test.…Test files must start with test underscore,…and end with dot py, test_faces.py.…
We'll import faces.…Then write def test_smoke, and pass,…which is Python for nothing.…The term smoke tests come from mechanical engineering.…The simplest test they do is turn on the machine.…If smoke comes out then something is wrong.…Otherwise, it's okay.…Since Python is not compiled, even this test…already brings benefits since it will catch syntax error,…missing models, and other problems.…Now let's run, pytest tests.…
This will fail since pytest will not automatically…add the current directory to where Python searches…for modules to import.…
- Working with Jupyter notebooks
- Using code cells
- Extensions to the Python language
- Markdown cells
- Editing notebooks
- NumPy basics
- Broadcasting, array operations, and ufuncs
- Folium and Geo
- Machine learning with scikit-learn
- Plotting with matplotlib and bokeh
- Branching into Numba, Cython, deep learning, and NLP
Skill Level Intermediate
Python: Data Analysis (2015)with Michele Vallisneri2h 16m Intermediate
NumPy Data Science Essential Trainingwith Charles Kelly3h 54m Intermediate
1. Scientific Python Overview
2. The Jupyter Notebook
3. NumPy Basics
Manage environments5m 11s
6. Folium and Geo
7. NY Taxi Data
10. Other Packages
11. Development Process
Next steps1m 33s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.