forked from runpod/runpod-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_whatever.py
More file actions
39 lines (30 loc) · 1.02 KB
/
test_whatever.py
File metadata and controls
39 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
This module contains unit tests for the 'whatever' module, specifically the is_even function.
"""
import unittest
from .whatever import is_even
class TestIsEven(unittest.TestCase):
"""
TestIsEven class contains test cases for the is_even function in the whatever module.
"""
def test_is_even_true(self):
"""
Test that is_even returns True for even numbers.
"""
job = {"input": {"number": 2}}
self.assertTrue(is_even(job))
def test_is_even_false(self):
"""
Test that is_even returns False for odd numbers.
"""
job = {"input": {"number": 3}}
self.assertFalse(is_even(job))
def test_is_even_error(self):
"""
Test that is_even returns an error message for non-integer inputs.
"""
job = {"input": {"number": "two"}}
expected_output = {"error": "Silly human, you need to pass an integer."}
self.assertEqual(is_even(job), expected_output)
if __name__ == "__main__":
unittest.main()