feat: check for non string names in Obs.__init__ optimized

This commit is contained in:
Fabian Joswig 2021-12-06 15:20:36 +00:00
parent 7937635ca2
commit 1f91175e50

View file

@ -80,6 +80,9 @@ class Obs:
raise Exception('names are not unique.') raise Exception('names are not unique.')
if not all(isinstance(x, str) for x in names): if not all(isinstance(x, str) for x in names):
raise TypeError('All names have to be strings.') raise TypeError('All names have to be strings.')
else:
if not isinstance(names[0], str):
raise TypeError('All names have to be strings.')
if min(len(x) for x in samples) <= 4: if min(len(x) for x in samples) <= 4:
raise Exception('Samples have to have at least 5 entries.') raise Exception('Samples have to have at least 5 entries.')