File tree 1 file changed +3
-6
lines changed 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ def _test():
102
102
import sys
103
103
import traceback
104
104
import unittest
105
- from io import StringIO
105
+ from io import StringIO , IncrementalNewlineDecoder
106
106
from collections import namedtuple
107
107
108
108
TestResults = namedtuple ('TestResults' , 'failed attempted' )
@@ -212,11 +212,8 @@ def _normalize_module(module, depth=2):
212
212
raise TypeError ("Expected a module, string, or None" )
213
213
214
214
def _newline_convert (data ):
215
- # We have two cases to cover and we need to make sure we do
216
- # them in the right order
217
- for newline in ('\r \n ' , '\r ' ):
218
- data = data .replace (newline , '\n ' )
219
- return data
215
+ # The IO module provides a handy decoder for universal newline conversion
216
+ return IncrementalNewlineDecoder (None , True ).decode (data , True )
220
217
221
218
def _load_testfile (filename , package , module_relative , encoding ):
222
219
if module_relative :
You can’t perform that action at this time.
0 commit comments