diff options
| author | Guido van Rossum <guido@dropbox.com> | 2013-11-07 16:39:28 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@dropbox.com> | 2013-11-07 16:39:28 (GMT) |
| commit | d0786a1a5036c06770f1c958323387fd682e789e (patch) | |
| tree | 69a5d2bc9cdea0202c72144e852ad9ec2f4bc590 /Lib/test/test_selectors.py | |
| parent | b7038817fee37fea81183d64c9dd957bab571fde (diff) | |
| download | cpython-d0786a1a5036c06770f1c958323387fd682e789e.zip cpython-d0786a1a5036c06770f1c958323387fd682e789e.tar.gz cpython-d0786a1a5036c06770f1c958323387fd682e789e.tar.bz2 | |
Optimize BaseSelector.modify(). Patch by Arnaud Faure.
Diffstat (limited to 'Lib/test/test_selectors.py')
| -rw-r--r-- | Lib/test/test_selectors.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py index fd0481d..c64c87a 100644 --- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -6,6 +6,7 @@ import socket from test import support from time import sleep import unittest +import unittest.mock try: from time import monotonic as time except ImportError: @@ -124,6 +125,15 @@ class BaseSelectorTestCase(unittest.TestCase): # modify unknown file obj self.assertRaises(KeyError, s.modify, 999999, selectors.EVENT_READ) + # modify use a shortcut + d3 = object() + s.register = unittest.mock.Mock() + s.unregister = unittest.mock.Mock() + + s.modify(rd, selectors.EVENT_READ, d3) + self.assertFalse(s.register.called) + self.assertFalse(s.unregister.called) + def test_close(self): s = self.SELECTOR() self.addCleanup(s.close) |
