Skip to content

Commit ca1a36a

Browse files
kpapdacWillAyd
authored andcommitted
DOC: Fix encoding of docstring validation for Windows (pandas-dev#25466)
1 parent 2e4e0b9 commit ca1a36a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

scripts/tests/test_validate_docstrings.py

+8
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,14 @@ def test_raises_for_invalid_attribute_name(self, invalid_name):
10521052
with pytest.raises(AttributeError, match=msg):
10531053
validate_docstrings.Docstring(invalid_name)
10541054

1055+
@pytest.mark.parametrize('name', ['pandas.Series.str.isdecimal',
1056+
'pandas.Series.str.islower'])
1057+
def test_encode_content_write_to_file(self, name):
1058+
# GH25466
1059+
docstr = validate_docstrings.Docstring(name).validate_pep8()
1060+
# the list of pep8 errors should be empty
1061+
assert not list(docstr)
1062+
10551063

10561064
class TestMainFunction:
10571065
def test_exit_status_for_validate_one(self, monkeypatch):

scripts/validate_docstrings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ def validate_pep8(self):
583583
application = flake8.main.application.Application()
584584
application.initialize(["--quiet"])
585585

586-
with tempfile.NamedTemporaryFile(mode='w') as file:
586+
with tempfile.NamedTemporaryFile(mode='w', encoding='utf-8') as file:
587587
file.write(content)
588588
file.flush()
589589
application.run_checks([file.name])

0 commit comments

Comments
 (0)