Skip to content

Commit 45fbf1b

Browse files
Jamimjhermann
authored andcommitted
Fix tests (#183)
The main goal of this commit is to fix the test_encoding_from_filelike test for Python 3.6+. As well, it fixes a couple of warnings.
1 parent 337ad5e commit 45fbf1b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/tests/test_configobj.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def cfg_lines(config_string_representation):
4242
first_content = lines[line_no_with_content]
4343
if isinstance(first_content, six.binary_type):
4444
first_content = first_content.decode('utf-8')
45-
ws_chars = len(re.search('^(\s*)', first_content).group(1))
45+
ws_chars = len(re.search(r'^(\s*)', first_content).group(1))
4646

4747
def yield_stringified_line():
4848
for line in lines:
@@ -52,7 +52,7 @@ def yield_stringified_line():
5252
yield line
5353

5454

55-
return [re.sub('^\s{0,%s}' % ws_chars, '', line).encode('utf-8')
55+
return [re.sub(r'^\s{0,%s}' % ws_chars, '', line).encode('utf-8')
5656
for line in yield_stringified_line()]
5757

5858

@@ -243,7 +243,7 @@ def test_encoding_in_config_files(self, request, ant_cfg):
243243

244244
def test_encoding_from_filelike(self):
245245
"""Test for fix of #18"""
246-
stream = mock.MagicMock()
246+
stream = mock.Mock()
247247
stream.read.return_value = b'text = \xc2\xa7'
248248
c = ConfigObj(stream, encoding='utf-8')
249249
text = c['text']

0 commit comments

Comments
 (0)