configtypes: Disallow ValidValues without values.

This commit is contained in:
Florian Bruhin 2015-10-02 11:37:41 +02:00
parent b863c9807b
commit 7761dd5af4
2 changed files with 6 additions and 0 deletions

View File

@ -79,6 +79,8 @@ class ValidValues:
"""
def __init__(self, *vals):
if not vals:
raise ValueError("ValidValues with no values makes no sense!")
self.descriptions = {}
self.values = []
for v in vals:

View File

@ -159,6 +159,10 @@ class TestValidValues:
def test_repr(self, klass, args, expected):
assert repr(klass(*args)) == expected
def test_empty(self, klass):
with pytest.raises(ValueError):
klass()
class TestBaseType: