From 2234c3f23d25de1d16adf73d585c8b8d070cb0b4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 24 Sep 2014 14:14:38 +0100 Subject: [PATCH] tests: Add test for exception matching of a tuple of exceptions. --- tests/basics/except_match_tuple.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/basics/except_match_tuple.py diff --git a/tests/basics/except_match_tuple.py b/tests/basics/except_match_tuple.py new file mode 100644 index 0000000000..fea2f51c07 --- /dev/null +++ b/tests/basics/except_match_tuple.py @@ -0,0 +1,21 @@ +# test exception matching against a tuple + +try: + fail +except (Exception,): + print('except 1') + +try: + fail +except (Exception, Exception): + print('except 2') + +try: + fail +except (TypeError, NameError): + print('except 3') + +try: + fail +except (TypeError, ValueError, Exception): + print('except 4')