mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
22 lines
556 B
Python
22 lines
556 B
Python
import unittest
|
|
|
|
|
|
class TestMaxProfit(unittest.TestCase):
|
|
|
|
def test_max_profit(self):
|
|
solution = Solution()
|
|
self.assertRaises(TypeError, solution.find_max_profit, None)
|
|
self.assertRaises(ValueError, solution.find_max_profit, [])
|
|
self.assertEqual(solution.find_max_profit([8, 5, 3, 2, 1]), -1)
|
|
self.assertEqual(solution.find_max_profit([5, 3, 7, 4, 2, 6, 9]), 7)
|
|
print('Success: test_max_profit')
|
|
|
|
|
|
def main():
|
|
test = TestMaxProfit()
|
|
test.test_max_profit()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|