]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_errno.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_errno.py
CommitLineData
4710c53d 1#! /usr/bin/env python\r
2"""Test the errno module\r
3 Roger E. Masse\r
4"""\r
5\r
6import errno\r
7from test import test_support\r
8import unittest\r
9\r
10std_c_errors = frozenset(['EDOM', 'ERANGE'])\r
11\r
12class ErrnoAttributeTests(unittest.TestCase):\r
13\r
14 def test_for_improper_attributes(self):\r
15 # No unexpected attributes should be on the module.\r
16 for error_code in std_c_errors:\r
17 self.assertTrue(hasattr(errno, error_code),\r
18 "errno is missing %s" % error_code)\r
19\r
20 def test_using_errorcode(self):\r
21 # Every key value in errno.errorcode should be on the module.\r
22 for value in errno.errorcode.itervalues():\r
23 self.assertTrue(hasattr(errno, value), 'no %s attr in errno' % value)\r
24\r
25\r
26class ErrorcodeTests(unittest.TestCase):\r
27\r
28 def test_attributes_in_errorcode(self):\r
29 for attribute in errno.__dict__.iterkeys():\r
30 if attribute.isupper():\r
31 self.assertIn(getattr(errno, attribute), errno.errorcode,\r
32 'no %s attr in errno.errorcode' % attribute)\r
33\r
34\r
35def test_main():\r
36 test_support.run_unittest(ErrnoAttributeTests, ErrorcodeTests)\r
37\r
38\r
39if __name__ == '__main__':\r
40 test_main()\r