From cc49ca25527e3cbe656468f947cefb18d62def66 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 27 Mar 2018 14:56:34 -0500 Subject: [PATCH] Fix: make sure on-creation errors are propagated --- islpy/__init__.py | 1 + test/test_isl.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/islpy/__init__.py b/islpy/__init__.py index 6d4e04f..48ee155 100644 --- a/islpy/__init__.py +++ b/islpy/__init__.py @@ -190,6 +190,7 @@ def _add_functionality(): # exception. This is creates a semi-valid state that's just good # enough to get us past the __del__ method. self.data = None + raise else: self._setup(new_me._release()) diff --git a/test/test_isl.py b/test/test_isl.py index b5469c8..28f023d 100644 --- a/test/test_isl.py +++ b/test/test_isl.py @@ -292,6 +292,14 @@ def test_id_constructor(): isl.Id(context=ctx, name='x0') +def test_creation_error(): + # note the (intentional) syntax error + with pytest.raises(isl.Error): + isl.BasicSet( + "[n0, n1] -> " + "{ [i0, i1, i2] : 0 <= i0 < n1 and 0 and 0 <= i2 <= 15 }") + + if __name__ == "__main__": import sys if len(sys.argv) > 1: -- GitLab