コード例 #1
0
 def test_lookup_town(self):
     s = State('Test State')
     s.process_record("Test Town", "Test District", "HS", "9-12")
     t = s._towns['Test Town']
     assert s.lookup_town("Test Town") is t
コード例 #2
0
 def test_lookup_fail_bad_grade(self):
     s = State('Test State')
     s.process_record("Test Town", "Test District", "HS", "9-12")
     with pytest.raises(ValueError) as verr:
         s.lookup_town("Test Town", 8)
     assert "Grade not found" in str(verr.value)
コード例 #3
0
 def test_lookup_fail_bad_town(self):
     s = State('Test State')
     s.process_record("Test Town", "Test District", "HS", "9-12")
     with pytest.raises(KeyError) as verr:
         s.lookup_town("Test Towns", 8)
     assert "Town not present" in str(verr.value)
コード例 #4
0
 def test_lookup_grade_as_string(self):
     s = State('Test State')
     s.process_record("Test Town", "Test District", "HS", "9-12")
     assert s.lookup_town("Test Town", '9') is "Test District"