|
16 | 16 |
|
17 | 17 | import copy |
18 | 18 | import unittest |
| 19 | +import sys |
19 | 20 |
|
20 | 21 | from pymongo.uri_parser import (_partition, |
21 | 22 | _rpartition, |
@@ -92,8 +93,16 @@ def test_split_options(self): |
92 | 93 | self.assertRaises(ConfigurationError, split_options, 'socketTimeoutMS=0.0') |
93 | 94 | self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=foo') |
94 | 95 | self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=0.0') |
95 | | - self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=inf') |
96 | | - self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=-inf') |
| 96 | + self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=1e100000') |
| 97 | + self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=-1e100000') |
| 98 | + |
| 99 | + # On most platforms float('inf') and float('-inf') represent |
| 100 | + # +/- infinity, although on Python 2.4 and 2.5 on Windows those |
| 101 | + # expressions are invalid |
| 102 | + if not (sys.platform == "win32" and sys.version_info <= (2, 5)): |
| 103 | + self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=inf') |
| 104 | + self.assertRaises(ConfigurationError, split_options, 'connectTimeoutMS=-inf') |
| 105 | + |
97 | 106 | self.assertTrue(split_options('socketTimeoutMS=300')) |
98 | 107 | self.assertTrue(split_options('connectTimeoutMS=300')) |
99 | 108 | self.assertEqual({'sockettimeoutms': 0.3}, split_options('socketTimeoutMS=300')) |
|
0 commit comments