diff options
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_cfgparser.py | 26 | ||||
| -rw-r--r-- | Lib/test/test_os.py | 9 |
2 files changed, 35 insertions, 0 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py index 7a9e8a8..cec9b44 100644 --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -797,6 +797,32 @@ boolean {0[0]} NO self.assertEqual(set(cf.sections()), set()) self.assertEqual(set(cf[self.default_section].keys()), {'foo'}) + def test_setitem(self): + cf = self.fromstring(""" + [section1] + name1 {0[0]} value1 + [section2] + name2 {0[0]} value2 + [section3] + name3 {0[0]} value3 + """.format(self.delimiters), defaults={"nameD": "valueD"}) + self.assertEqual(set(cf['section1'].keys()), {'name1', 'named'}) + self.assertEqual(set(cf['section2'].keys()), {'name2', 'named'}) + self.assertEqual(set(cf['section3'].keys()), {'name3', 'named'}) + self.assertEqual(cf['section1']['name1'], 'value1') + self.assertEqual(cf['section2']['name2'], 'value2') + self.assertEqual(cf['section3']['name3'], 'value3') + self.assertEqual(cf.sections(), ['section1', 'section2', 'section3']) + cf['section2'] = {'name22': 'value22'} + self.assertEqual(set(cf['section2'].keys()), {'name22', 'named'}) + self.assertEqual(cf['section2']['name22'], 'value22') + self.assertNotIn('name2', cf['section2']) + self.assertEqual(cf.sections(), ['section1', 'section2', 'section3']) + cf['section3'] = {} + self.assertEqual(set(cf['section3'].keys()), {'named'}) + self.assertNotIn('name3', cf['section3']) + self.assertEqual(cf.sections(), ['section1', 'section2', 'section3']) + class StrictTestCase(BasicTestCase): config_class = configparser.RawConfigParser diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5b67da1..bd799b2 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1057,6 +1057,15 @@ if sys.platform != 'win32': f = open(os.path.join(self.dir, fn), 'rb') f.close() + @unittest.skipUnless(hasattr(os, 'statvfs'), + "need os.statvfs()") + def test_statvfs(self): + # issue #9645 + for fn in self.unicodefn: + # should not fail with file not found error + fullname = os.path.join(self.dir, fn) + os.statvfs(fullname) + def test_stat(self): for fn in self.unicodefn: os.stat(os.path.join(self.dir, fn)) |
