interactive-coding-challenges/math_probability/math_ops/test_math_ops.py

34 lines
793 B
Python
Raw Normal View History

import unittest
2017-03-29 16:44:38 +08:00
class TestMathOps(unittest.TestCase):
2017-03-29 16:44:38 +08:00
def test_math_ops(self):
solution = Solution()
self.assertRaises(TypeError, solution.insert, None)
2017-03-29 16:44:38 +08:00
solution.insert(5)
solution.insert(2)
solution.insert(7)
solution.insert(9)
solution.insert(9)
solution.insert(2)
solution.insert(9)
solution.insert(4)
solution.insert(3)
solution.insert(3)
solution.insert(2)
self.assertEqual(solution.max, 9)
self.assertEqual(solution.min, 2)
self.assertEqual(solution.mean, 5)
self.assertTrue(solution.mode in (2, 9))
2017-03-29 16:44:38 +08:00
print('Success: test_math_ops')
def main():
test = TestMathOps()
test.test_math_ops()
if __name__ == '__main__':
main()