Commit df7a90e1 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Ioannis Papagiannopoulos

RandomNumberGenerator to require distribution to be given as dictionary

parent 2809d359
......@@ -38,7 +38,10 @@ class RandomNumberGenerator(object):
# ...
# },
def __init__(self, obj, distribution):
# check in case an inknown distrbution was given
# if the distribution is not given as a dictionary throw error
if not isinstance(distribution, dict):
raise ValueError("distribution must be given as a dict")
# check in case an unknown distribution was given
unknownDistribution=True
for key in distribution.keys():
if key in ['Fixed', 'Normal','Exp','Gamma','Logistic','Erlang',
......
......@@ -67,7 +67,7 @@ class RandomNumberGeneratorTestCase(TestCase):
})
self.assertRaises(ValueError, rng.generateNumber)
def testUnkonwnDistribution(self):
def testUnknownDistribution(self):
rng = RandomNumberGenerator(obj, distribution='Unknown')
self.assertRaises(ValueError, rng.generateNumber)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment