From 2f952abf82c36c817cbbc1e3654b990a496d50ad Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 14 May 2020 21:21:54 +0200 Subject: Use unittest machanism to assert on exceptions Signed-off-by: Olivier Gayot --- tests/test_cards.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/test_cards.py b/tests/test_cards.py index 019d512..ea49847 100644 --- a/tests/test_cards.py +++ b/tests/test_cards.py @@ -13,15 +13,7 @@ class TestCards(unittest.TestCase): self.assertTrue(Cards.get_black_cards("en")) def test_get_cards_unknown_language(self): - try: + with self.assertRaises(FileNotFoundError): Cards.get_white_cards("zz") - except FileNotFoundError: - pass - else: - self.fail("Found zz white cards.") - try: + with self.assertRaises(FileNotFoundError): Cards.get_black_cards("zz") - except FileNotFoundError: - pass - else: - self.fail("Found zz black cards.") -- cgit v1.2.3