summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index f115aa8..7ed45ac 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -703,7 +703,8 @@ class PosixTester(unittest.TestCase):
self.assertEqual(posix.major(dev), major)
self.assertRaises(TypeError, posix.major, float(dev))
self.assertRaises(TypeError, posix.major)
- self.assertRaises((ValueError, OverflowError), posix.major, -1)
+ for x in -2, 2**64, -2**63-1:
+ self.assertRaises((ValueError, OverflowError), posix.major, x)
minor = posix.minor(dev)
self.assertIsInstance(minor, int)
@@ -711,13 +712,23 @@ class PosixTester(unittest.TestCase):
self.assertEqual(posix.minor(dev), minor)
self.assertRaises(TypeError, posix.minor, float(dev))
self.assertRaises(TypeError, posix.minor)
- self.assertRaises((ValueError, OverflowError), posix.minor, -1)
+ for x in -2, 2**64, -2**63-1:
+ self.assertRaises((ValueError, OverflowError), posix.minor, x)
self.assertEqual(posix.makedev(major, minor), dev)
self.assertRaises(TypeError, posix.makedev, float(major), minor)
self.assertRaises(TypeError, posix.makedev, major, float(minor))
self.assertRaises(TypeError, posix.makedev, major)
self.assertRaises(TypeError, posix.makedev)
+ for x in -2, 2**32, 2**64, -2**63-1:
+ self.assertRaises((ValueError, OverflowError), posix.makedev, x, minor)
+ self.assertRaises((ValueError, OverflowError), posix.makedev, major, x)
+
+ if sys.platform == 'linux':
+ NODEV = -1
+ self.assertEqual(posix.major(NODEV), NODEV)
+ self.assertEqual(posix.minor(NODEV), NODEV)
+ self.assertEqual(posix.makedev(NODEV, NODEV), NODEV)
def _test_all_chown_common(self, chown_func, first_param, stat_func):
"""Common code for chown, fchown and lchown tests."""