summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2017-03-03 17:48:37 (GMT)
committerGitHub <noreply@github.com>2017-03-03 17:48:37 (GMT)
commit21ce65aa67f0dc63002ab0a5fb21ef921cf5279e (patch)
tree57a9bf2020d05d6e89f70fabe5b80852a26634e3 /Lib/test
parentc7ff163abf428d73d4054754db3c99d06487e3ad (diff)
downloadcpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.zip
cpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.tar.gz
cpython-21ce65aa67f0dc63002ab0a5fb21ef921cf5279e.tar.bz2
[3.6] bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) (#432)
(cherry picked from commit 85b8d01c916b482dac937b93ede1e53b1db0361c) Conflicts: Lib/test/test_configparser.py
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_configparser.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py
index 0d06080..72c3f19 100644
--- a/Lib/test/test_configparser.py
+++ b/Lib/test/test_configparser.py
@@ -2,7 +2,7 @@ import collections
import configparser
import io
import os
-import sys
+import pathlib
import textwrap
import unittest
import warnings
@@ -721,6 +721,16 @@ boolean {0[0]} NO
parsed_files = cf.read(file1)
self.assertEqual(parsed_files, [file1])
self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
+ # check when we pass only a Path object:
+ cf = self.newconfig()
+ parsed_files = cf.read(pathlib.Path(file1))
+ self.assertEqual(parsed_files, [file1])
+ self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
+ # check when we passed both a filename and a Path object:
+ cf = self.newconfig()
+ parsed_files = cf.read([pathlib.Path(file1), file1])
+ self.assertEqual(parsed_files, [file1, file1])
+ self.assertEqual(cf.get("Foo Bar", "foo"), "newbar")
# check when we pass only missing files:
cf = self.newconfig()
parsed_files = cf.read(["nonexistent-file"])