+++ /dev/null
-#! /usr/bin/env python\r
-"""Test the errno module\r
- Roger E. Masse\r
-"""\r
-\r
-import errno\r
-from test import test_support\r
-import unittest\r
-\r
-std_c_errors = frozenset(['EDOM', 'ERANGE'])\r
-\r
-class ErrnoAttributeTests(unittest.TestCase):\r
-\r
- def test_for_improper_attributes(self):\r
- # No unexpected attributes should be on the module.\r
- for error_code in std_c_errors:\r
- self.assertTrue(hasattr(errno, error_code),\r
- "errno is missing %s" % error_code)\r
-\r
- def test_using_errorcode(self):\r
- # Every key value in errno.errorcode should be on the module.\r
- for value in errno.errorcode.itervalues():\r
- self.assertTrue(hasattr(errno, value), 'no %s attr in errno' % value)\r
-\r
-\r
-class ErrorcodeTests(unittest.TestCase):\r
-\r
- def test_attributes_in_errorcode(self):\r
- for attribute in errno.__dict__.iterkeys():\r
- if attribute.isupper():\r
- self.assertIn(getattr(errno, attribute), errno.errorcode,\r
- 'no %s attr in errno.errorcode' % attribute)\r
-\r
-\r
-def test_main():\r
- test_support.run_unittest(ErrnoAttributeTests, ErrorcodeTests)\r
-\r
-\r
-if __name__ == '__main__':\r
- test_main()\r