Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit 25c96fe

Browse files
author
Frederik De Bleser
committed
Ported the old "All Errors" file to proper unit tests.
1 parent caeddaf commit 25c96fe

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

tests/All Errors.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/graphics.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@
1111

1212
class GraphicsTestCase(unittest.TestCase):
1313

14+
def test_arrow_type_error(self):
15+
"""Test if passing a wrong arrow type raises an error."""
16+
ctx = Context()
17+
self.assertRaises(NodeBoxError, ctx.arrow, 0, 0, 100, type=42)
18+
19+
def test_too_many_pops(self):
20+
"""Test if popping too many times raises an error."""
21+
ctx = Context()
22+
self.assertRaises(NodeBoxError, ctx.pop)
23+
24+
def test_font_not_found(self):
25+
"""Test if setting an unexisting font raises an error."""
26+
ctx = Context()
27+
old_font = ctx.font()
28+
self.assertRaises(NodeBoxError, ctx.font, "THIS_FONT_DOES_NOT_EXIST")
29+
self.assertEquals(ctx.font(), old_font, "Current font has not changed.")
30+
1431
def test_ellipse(self):
1532
"""Test if ellipse is an alias for oval."""
1633
ctx = Context()

0 commit comments

Comments
 (0)