Addxing some fixes

This commit is contained in:
Jake Poznanski 2025-03-19 18:57:00 +00:00
parent 3005ebd67d
commit c25e9cb084
2 changed files with 20 additions and 0 deletions

View File

@ -306,6 +306,7 @@ def main():
half_width = ((ci[1] - ci[0]) / 2) * 100
ciw_str = f"± {half_width:0.1f}%"
print(f"{candidate_name:20s} : Average Score: {status} {ciw_str}")
test_type_breakdown.sort(key=lambda f: f[0])
for ttype, scores in test_type_breakdown.items():
avg = sum(scores) / len(scores) * 100 if scores else 0.0
print(f" {ttype:8s}: {avg:0.1f}% average pass rate over {len(scores)} tests")

View File

@ -572,6 +572,25 @@ Some text before the table.
result, explanation = test.run(table)
self.assertTrue(result, explanation)
def test_big_table(self):
# TODO this would work with html tables with a rowspan?
table = """| Question - Satisfaction on scale of 10 | Response | Resident Sample | Business Sample |
|----------------------------------------|----------|----------------|-----------------|
| Planning for and managing residential, commercial and industrial development | Rating of 8, 9 or 10 | 13% | 11% |
| | Average rating | 6.4 | 5.7 |
| | Dont know responses | 11% | 6% |
| Environmental protection, support for green projects (e.g. green grants, building retrofits programs, zero waste) | Rating of 8, 9 or 10 | 35% | 34% |
| | Average rating | 8.0 | 7.5 |
| | Dont know responses | 8% | 6% |
| Providing and maintaining parks and green spaces | Rating of 8, 9 or 10 | 42% | 41% |
| | Average rating | 7.7 | 7.3 |
| | Dont know responses | 1% | 1% |
Base: Resident respondents (n=1,315) and Business respondents (n=397)
"""
test = TableTest(pdf="test.pdf", page=1, id="test_id", type=TestType.TABLE.value, cell="Planning for and managing residential, commercial and industrial development", down="Environmental protection,\nsupport for green projects\n(e.g. green grants,\nbuilding retrofits programs,\nzero waste)")
result, explanation = test.run(table)
self.assertTrue(result, explanation)
class TestBaselineTest(unittest.TestCase):
"""Test the BaselineTest class"""