""" Unit Tests für report – sie müssen vor und nach dem Refactoring grün sein """ from report import report def test_promoted(): """ alle Fächer genügend """ assert report('Mia', [4.5, 5.0], [5.5, 6.0], [4.5, 4.5]) == ( 'Zeugnis Mia\n' 'Mathe: 5.0\n' 'Deutsch: 6.0\n' 'Englisch: 4.5\n' 'Schnitt: 5.2\n' 'promoviert' ) def test_one_fail_promoted(): """ eine ungenügende Note ist erlaubt, wenn der Schnitt reicht """ assert report('Tim', [3.0, 3.5], [5.0, 5.0], [4.5, 4.5]).endswith('Schnitt: 4.2\npromoviert') def test_two_fails_not_promoted(): """ zwei ungenügende Noten führen zur Nichtpromotion """ assert report('Ela', [3.0, 3.5], [3.5, 3.5], [6.0, 6.0]).endswith('nicht promoviert') def test_average_too_low(): """ Schnitt unter 4 führt zur Nichtpromotion """ assert report('Leo', [3.5], [4.0], [4.0]).endswith('Schnitt: 3.8\nnicht promoviert')