SpecArgumentTypeString should return None when no args

This commit is contained in:
jesopo 2020-01-29 17:04:17 +00:00
parent 005334e2be
commit c1543ed899

View file

@ -44,7 +44,9 @@ class SpecArgumentTypeString(SpecArgumentType):
def name(self): def name(self):
return "%s ..." % SpecArgumentType.name(self) return "%s ..." % SpecArgumentType.name(self)
def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]: def simple(self, args: typing.List[str]) -> typing.Tuple[typing.Any, int]:
if args:
return " ".join(args), len(args) return " ".join(args), len(args)
return None, 1
class SpecArgumentTypeTrimString(SpecArgumentTypeString): class SpecArgumentTypeTrimString(SpecArgumentTypeString):
def simple(self, args: typing.List[str]): def simple(self, args: typing.List[str]):
return SpecArgumentTypeString.simple(self, list(filter(None, args))) return SpecArgumentTypeString.simple(self, list(filter(None, args)))