From 462de9847c2271dbd7de149ae775e785c5d31daf Mon Sep 17 00:00:00 2001 From: alalazo Date: Mon, 28 Aug 2017 21:55:34 +0200 Subject: Added unit tests for Spec.__init__ exceptional paths --- lib/spack/spack/test/spec_semantics.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index 4ed7c635e9..2c7c1d22ed 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -707,3 +707,14 @@ class TestSpecSematics(object): check_constrain_not_changed( 'libelf^foo target=' + default_target, 'libelf^foo target=' + default_target) + + def test_exceptional_paths_for_constructor(self): + + with pytest.raises(TypeError): + Spec((1, 2)) + + with pytest.raises(ValueError): + Spec('') + + with pytest.raises(ValueError): + Spec('libelf foo') -- cgit v1.2.3-60-g2f50