Spaces:
Sleeping
Sleeping
Download dataset/problem_9/test.py from Viraj0112/rl_code_fix_env: direct link, hf CLI and curl.
- Browser
- Download file 461 Bytes
-
https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_9/test.py
- Command line
-
hf download hf://spaces/Viraj0112/rl_code_fix_env/dataset/problem_9/test.py
-
curl -L -o test.py https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_9/test.py
461 Bytes
| import unittest | |
| from dataset.problem_9.buggy import safe_divide | |
| class TestSafeDivide(unittest.TestCase): | |
| def test_normal(self): | |
| self.assertEqual(safe_divide(8, 2), 4) | |
| def test_zero_division(self): | |
| self.assertEqual(safe_divide(1, 0), float("inf")) | |
| def test_type_error_should_raise(self): | |
| with self.assertRaises(TypeError): | |
| safe_divide("1", 1) | |
| if __name__ == "__main__": | |
| unittest.main() | |