-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from sbenthall/issue-404
Issue 404 - refactoring simulation.py
- Loading branch information
Showing
2 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import unittest | ||
|
||
import HARK.simulation as simulation | ||
|
||
class SimulationTests(unittest.TestCase): | ||
''' | ||
Tests for simulation.py sampling distributions | ||
with default seed. | ||
''' | ||
|
||
def test_drawMeanOneLognormal(self): | ||
self.assertEqual( | ||
simulation.drawMeanOneLognormal(1)[0], | ||
3.5397367004222002) | ||
|
||
def test_drawLognormal(self): | ||
self.assertEqual( | ||
simulation.drawLognormal(1)[0], | ||
5.836039190663969) | ||
|
||
def test_drawNormal(self): | ||
self.assertEqual( | ||
simulation.drawNormal(1)[0], | ||
1.764052345967664) | ||
|
||
def test_drawWeibull(self): | ||
self.assertEqual( | ||
simulation.drawWeibull(1)[0], | ||
0.79587450816311) | ||
|
||
def test_drawUniform(self): | ||
self.assertEqual( | ||
simulation.drawUniform(1)[0], | ||
0.5488135039273248) | ||
|
||
def test_drawBernoulli(self): | ||
self.assertEqual( | ||
simulation.drawBernoulli(1)[0], | ||
False) | ||
|
||
|
||
def test_drawDiscrete(self): | ||
self.assertEqual( | ||
simulation.drawDiscrete(1)[0], | ||
0) | ||
|