Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse_args(self):
with self.assertRaises(SystemExit) as cm:
parse_args([])
assert cm.exception.code == 2
args = parse_args(["_"])
assert args.command == '_'
args = parse_args(["_", "-i", "os:environ:env"])
assert "os:environ:env" in getattr(args, 'import')
assert args.command == '_'
with self.assertRaises(NameError):
json
execute_imports(['json'])
assert 'json' in sys.modules