Coverage for test_triangles.py: 100%
11 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-30 05:17 -0400
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-30 05:17 -0400
1"""Test the triangles module.
3Name: YOUR NAME
4Date: THE DATE
5"""
7from pytest import approx, raises
8from triangles import valid, area, classify
11def test_valid():
12 # NOTE: You should never type "== True".
13 assert valid((3, 4, 5))
14 # NOTE: You should never type "== False".
15 assert not valid((3, 4, 10))
18def test_area():
19 # NOTE: Use approx() to avoid floating-point errors.
20 assert area((3, 4, 5)) == approx(6.0)
21 # NOTE: Use raises() to check if errors are raised.
22 with raises(ValueError):
23 area((3, 4, 10))
26def test_classify():
27 assert classify((3, 4, 5)) == "Scalene"