@@ -1793,6 +1793,7 @@ def test_decode(self):
1793
1793
self .assertEqual (codecs .decode (b'[\xff ]' , 'ascii' , errors = 'ignore' ),
1794
1794
'[]' )
1795
1795
1796
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1796
1797
def test_encode (self ):
1797
1798
self .assertEqual (codecs .encode ('\xe4 \xf6 \xfc ' , 'latin-1' ),
1798
1799
b'\xe4 \xf6 \xfc ' )
@@ -1807,14 +1808,11 @@ def test_encode(self):
1807
1808
self .assertEqual (codecs .encode ('[\xff ]' , 'ascii' , errors = 'ignore' ),
1808
1809
b'[]' )
1809
1810
1810
- # TODO: RUSTPYTHON
1811
- if sys .platform == "win32" :
1812
- test_encode = unittest .expectedFailure (test_encode )
1813
-
1814
1811
def test_register (self ):
1815
1812
self .assertRaises (TypeError , codecs .register )
1816
1813
self .assertRaises (TypeError , codecs .register , 42 )
1817
1814
1815
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON; AttributeError: module '_winapi' has no attribute 'GetACP'" )
1818
1816
def test_unregister (self ):
1819
1817
name = "nonexistent_codec_name"
1820
1818
search_function = mock .Mock ()
@@ -1827,51 +1825,32 @@ def test_unregister(self):
1827
1825
self .assertRaises (LookupError , codecs .lookup , name )
1828
1826
search_function .assert_not_called ()
1829
1827
1830
- # TODO: RUSTPYTHON, AttributeError: module '_winapi' has no attribute 'GetACP'
1831
- if sys .platform == "win32" :
1832
- test_unregister = unittest .expectedFailure (test_unregister )
1833
-
1828
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1834
1829
def test_lookup (self ):
1835
1830
self .assertRaises (TypeError , codecs .lookup )
1836
1831
self .assertRaises (LookupError , codecs .lookup , "__spam__" )
1837
1832
self .assertRaises (LookupError , codecs .lookup , " " )
1838
1833
1839
- # TODO: RUSTPYTHON
1840
- if sys .platform == "win32" :
1841
- test_lookup = unittest .expectedFailure (test_lookup )
1842
-
1834
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1843
1835
def test_getencoder (self ):
1844
1836
self .assertRaises (TypeError , codecs .getencoder )
1845
1837
self .assertRaises (LookupError , codecs .getencoder , "__spam__" )
1846
1838
1847
- # TODO: RUSTPYTHON
1848
- if sys .platform == "win32" :
1849
- test_getencoder = unittest .expectedFailure (test_getencoder )
1850
-
1839
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1851
1840
def test_getdecoder (self ):
1852
1841
self .assertRaises (TypeError , codecs .getdecoder )
1853
1842
self .assertRaises (LookupError , codecs .getdecoder , "__spam__" )
1854
1843
1855
- # TODO: RUSTPYTHON
1856
- if sys .platform == "win32" :
1857
- test_getdecoder = unittest .expectedFailure (test_getdecoder )
1858
-
1844
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1859
1845
def test_getreader (self ):
1860
1846
self .assertRaises (TypeError , codecs .getreader )
1861
1847
self .assertRaises (LookupError , codecs .getreader , "__spam__" )
1862
1848
1863
- # TODO: RUSTPYTHON
1864
- if sys .platform == "win32" :
1865
- test_getreader = unittest .expectedFailure (test_getreader )
1866
-
1849
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1867
1850
def test_getwriter (self ):
1868
1851
self .assertRaises (TypeError , codecs .getwriter )
1869
1852
self .assertRaises (LookupError , codecs .getwriter , "__spam__" )
1870
1853
1871
- # TODO: RUSTPYTHON
1872
- if sys .platform == "win32" :
1873
- test_getwriter = unittest .expectedFailure (test_getwriter )
1874
-
1875
1854
def test_lookup_issue1813 (self ):
1876
1855
# Issue #1813: under Turkish locales, lookup of some codecs failed
1877
1856
# because 'I' is lowercased as "ı" (dotless i)
@@ -1926,6 +1905,7 @@ def test_undefined(self):
1926
1905
self .assertRaises (UnicodeError ,
1927
1906
codecs .decode , b'abc' , 'undefined' , errors )
1928
1907
1908
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
1929
1909
def test_file_closes_if_lookup_error_raised (self ):
1930
1910
mock_open = mock .mock_open ()
1931
1911
with mock .patch ('builtins.open' , mock_open ) as file :
@@ -1934,11 +1914,6 @@ def test_file_closes_if_lookup_error_raised(self):
1934
1914
1935
1915
file ().close .assert_called ()
1936
1916
1937
- # TODO: RUSTPYTHON
1938
- if sys .platform == "win32" :
1939
- test_file_closes_if_lookup_error_raised = unittest .expectedFailure (test_file_closes_if_lookup_error_raised )
1940
-
1941
-
1942
1917
class StreamReaderTest (unittest .TestCase ):
1943
1918
1944
1919
def setUp (self ):
@@ -3190,51 +3165,37 @@ def raise_obj(*args, **kwds):
3190
3165
with self .assertRaisesRegex (RuntimeError , msg ):
3191
3166
codecs .decode (b"bytes input" , self .codec_name )
3192
3167
3168
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3193
3169
def test_init_override_is_not_wrapped (self ):
3194
3170
class CustomInit (RuntimeError ):
3195
3171
def __init__ (self ):
3196
3172
pass
3197
3173
self .check_not_wrapped (CustomInit , "" )
3198
3174
3199
- # TODO: RUSTPYTHON
3200
- if sys .platform == "win32" :
3201
- test_init_override_is_not_wrapped = unittest .expectedFailure (test_init_override_is_not_wrapped )
3202
-
3175
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3203
3176
def test_new_override_is_not_wrapped (self ):
3204
3177
class CustomNew (RuntimeError ):
3205
3178
def __new__ (cls ):
3206
3179
return super ().__new__ (cls )
3207
3180
self .check_not_wrapped (CustomNew , "" )
3208
3181
3209
- # TODO: RUSTPYTHON
3210
- if sys .platform == "win32" :
3211
- test_new_override_is_not_wrapped = unittest .expectedFailure (test_new_override_is_not_wrapped )
3212
-
3182
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3213
3183
def test_instance_attribute_is_not_wrapped (self ):
3214
3184
msg = "This should NOT be wrapped"
3215
3185
exc = RuntimeError (msg )
3216
3186
exc .attr = 1
3217
3187
self .check_not_wrapped (exc , "^{}$" .format (msg ))
3218
3188
3219
- # TODO: RUSTPYTHON
3220
- if sys .platform == "win32" :
3221
- test_instance_attribute_is_not_wrapped = unittest .expectedFailure (test_instance_attribute_is_not_wrapped )
3222
-
3189
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3223
3190
def test_non_str_arg_is_not_wrapped (self ):
3224
3191
self .check_not_wrapped (RuntimeError (1 ), "1" )
3225
3192
3226
- # TODO: RUSTPYTHON
3227
- if sys .platform == "win32" :
3228
- test_non_str_arg_is_not_wrapped = unittest .expectedFailure (test_non_str_arg_is_not_wrapped )
3229
-
3193
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3230
3194
def test_multiple_args_is_not_wrapped (self ):
3231
3195
msg_re = r"^\('a', 'b', 'c'\)$"
3232
3196
self .check_not_wrapped (RuntimeError ('a' , 'b' , 'c' ), msg_re )
3233
3197
3234
- # TODO: RUSTPYTHON
3235
- if sys .platform == "win32" :
3236
- test_multiple_args_is_not_wrapped = unittest .expectedFailure (test_multiple_args_is_not_wrapped )
3237
-
3198
+ @unittest .expectedFailureIfWindows ("TODO: RUSTPYTHON" )
3238
3199
# http://bugs.python.org/issue19609
3239
3200
def test_codec_lookup_failure_not_wrapped (self ):
3240
3201
msg = "^unknown encoding: {}$" .format (self .codec_name )
@@ -3248,10 +3209,6 @@ def test_codec_lookup_failure_not_wrapped(self):
3248
3209
with self .assertRaisesRegex (LookupError , msg ):
3249
3210
codecs .decode (b"bytes input" , self .codec_name )
3250
3211
3251
- # TODO: RUSTPYTHON
3252
- if sys .platform == "win32" :
3253
- test_codec_lookup_failure_not_wrapped = unittest .expectedFailure (test_codec_lookup_failure_not_wrapped )
3254
-
3255
3212
# TODO: RUSTPYTHON
3256
3213
@unittest .expectedFailure
3257
3214
def test_unflagged_non_text_codec_handling (self ):
0 commit comments