Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbailey committed Dec 14, 2019
1 parent b4ac793 commit ad4812f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_impact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Tests for the Impact class
"""
import unittest

import numpy as np

from rail import Impact

NAME = "Test Impact"
MU = 100
SIGMA = 10


class TestImpact(unittest.TestCase):
"""
Class to test an impact
"""

def setUp(self):
self.impact = Impact(NAME, MU, SIGMA)

def test_impact(self):
"""
Test a impact
"""
self.assertEqual(self.impact["name"], NAME)
self.assertEqual(self.impact["mu"], MU)
self.assertEqual(self.impact["sigma"], SIGMA)
self.assertEqual(self.impact["mean"], np.exp(MU + SIGMA ** 2 / 2))
self.assertEqual(self.impact["median"], np.exp(MU))


if __name__ == "__main__":
unittest.main()

0 comments on commit ad4812f

Please sign in to comment.