Fix bug of render()

This commit is contained in:
Richard Chien 2018-07-21 23:51:50 +08:00
parent 65b7997d39
commit 7953ed43cb

View File

@ -16,7 +16,7 @@ def render(expr: Union[str, Sequence[str], Callable], *, escape_args=True,
""" """
if isinstance(expr, Callable): if isinstance(expr, Callable):
expr = expr() expr = expr()
elif isinstance(expr, Sequence): elif isinstance(expr, Sequence) and not isinstance(expr, str):
expr = random.choice(expr) expr = random.choice(expr)
if escape_args: if escape_args:
for k, v in kwargs.items(): for k, v in kwargs.items():