fix bug where datasources with empty sets would generate the wrong response
This commit is contained in:
parent
38fd1e9356
commit
4ed084965e
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "random-sets"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "A small library of helper classes for dealing with random data using weighted distributions"
|
||||
authors = ["evilchili <evilchili@gmail.com>"]
|
||||
readme = "README.md"
|
||||
|
|
|
@ -124,7 +124,7 @@ class DataSource:
|
|||
# If there is no data for the specified option, stop now.
|
||||
flattened = [option]
|
||||
if not self.data[option]:
|
||||
flattened
|
||||
return random.choice(flattened) if rand else flattened
|
||||
|
||||
if hasattr(self.data[option], 'keys'):
|
||||
# if the option is a dict, we assume the values are lists; we select a random item
|
||||
|
|
Loading…
Reference in New Issue
Block a user