gh-103724: Add test case if no arg as provided in os.register_at_fork (gh-103725)

This commit is contained in:
Ankit Kumar Pandey 2023-04-24 04:44:14 +05:30 committed by GitHub
parent 82932b72ca
commit 7255bbd4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -231,6 +231,9 @@ class PosixTester(unittest.TestCase):
with self.assertRaises(TypeError, msg="Invalid arg was allowed"):
# Ensure a combination of valid and invalid is an error.
os.register_at_fork(before=None, after_in_parent=lambda: 3)
with self.assertRaises(TypeError, msg="At least one argument is required"):
# when no arg is passed
os.register_at_fork()
with self.assertRaises(TypeError, msg="Invalid arg was allowed"):
# Ensure a combination of valid and invalid is an error.
os.register_at_fork(before=lambda: None, after_in_child='')