Chapter 3 Video 3
Title: Parametrization
Description: The code in the video did not show how to update the test function's signature after implementing parametrization.
Example
FROM
def test_altitude_stat_per_country(process_data):
....
TO
@pytest.mark.parametrize('country,stat,expected', [
(....),
(....)
])
def test_altitude_stat_per_country(process_data, country, stat, expected):
....
Chapter 3 Video 2
Title: Factory fixtures
Description: The current condition meant to determine whether or not to read a CSV or JSON file will lead to always trying to read CSV files.
See PR #1. The _specify_type function is a bit confusing in that it seems to be communicating that it's able to find a file based on its filename or file type, when in reality it only needs to do a search for a given filename and use the appropriate file processor to read the file based on the file's type.
Example
def _specify_file(filename):
files = os.listdir(city_list_location)
for f in files:
if filename == f:
if filename.endswith('.json'):
data = data_processor.json_reader(city_list_location + f)
elif filename.endswith('.csv'):
data = data_processor.csv_reader(city_list_location + f)
return data
Misc
In some places we return from fixture functions and in others we yield, but there's no explanation for why we do one or the other.
[nit] In Chapter 2 Video 2 we introduce how to mark instance variables as private, but did not keep the instance variables for the Point class private for the videos following.
[nit] In Chapter 2 Video 4 we expected a ValueError to be raised where a TypeError would have been more appropriate. This is minor as the essential lesson on how to test for exceptions is not lost.
Chapter 3 Video 3
Title: Parametrization
Description: The code in the video did not show how to update the test function's signature after implementing parametrization.
Example
FROM
TO
Chapter 3 Video 2
Title: Factory fixtures
Description: The current condition meant to determine whether or not to read a CSV or JSON file will lead to always trying to read CSV files.
See PR #1. The
_specify_typefunction is a bit confusing in that it seems to be communicating that it's able to find a file based on its filename or file type, when in reality it only needs to do a search for a given filename and use the appropriate file processor to read the file based on the file's type.Example
Misc
In some places we
returnfrom fixture functions and in others weyield, but there's no explanation for why we do one or the other.[nit] In Chapter 2 Video 2 we introduce how to mark instance variables as private, but did not keep the instance variables for the Point class private for the videos following.
[nit] In Chapter 2 Video 4 we expected a ValueError to be raised where a TypeError would have been more appropriate. This is minor as the essential lesson on how to test for exceptions is not lost.