◐ Shell
clean mode source ↗

Add unittset.expectedFailureIf for RustPython by youknowone · Pull Request #4597 · RustPython/RustPython

Expand Up @@ -1793,6 +1793,7 @@ def test_decode(self): self.assertEqual(codecs.decode(b'[\xff]', 'ascii', errors='ignore'), '[]')
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_encode(self): self.assertEqual(codecs.encode('\xe4\xf6\xfc', 'latin-1'), b'\xe4\xf6\xfc') Expand All @@ -1807,14 +1808,11 @@ def test_encode(self): self.assertEqual(codecs.encode('[\xff]', 'ascii', errors='ignore'), b'[]')
# TODO: RUSTPYTHON if sys.platform == "win32": test_encode = unittest.expectedFailure(test_encode)
def test_register(self): self.assertRaises(TypeError, codecs.register) self.assertRaises(TypeError, codecs.register, 42)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AttributeError: module '_winapi' has no attribute 'GetACP'") def test_unregister(self): name = "nonexistent_codec_name" search_function = mock.Mock() Expand All @@ -1827,51 +1825,32 @@ def test_unregister(self): self.assertRaises(LookupError, codecs.lookup, name) search_function.assert_not_called()
# TODO: RUSTPYTHON, AttributeError: module '_winapi' has no attribute 'GetACP' if sys.platform == "win32": test_unregister = unittest.expectedFailure(test_unregister)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_lookup(self): self.assertRaises(TypeError, codecs.lookup) self.assertRaises(LookupError, codecs.lookup, "__spam__") self.assertRaises(LookupError, codecs.lookup, " ")
# TODO: RUSTPYTHON if sys.platform == "win32": test_lookup = unittest.expectedFailure(test_lookup)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_getencoder(self): self.assertRaises(TypeError, codecs.getencoder) self.assertRaises(LookupError, codecs.getencoder, "__spam__")
# TODO: RUSTPYTHON if sys.platform == "win32": test_getencoder = unittest.expectedFailure(test_getencoder)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_getdecoder(self): self.assertRaises(TypeError, codecs.getdecoder) self.assertRaises(LookupError, codecs.getdecoder, "__spam__")
# TODO: RUSTPYTHON if sys.platform == "win32": test_getdecoder = unittest.expectedFailure(test_getdecoder)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_getreader(self): self.assertRaises(TypeError, codecs.getreader) self.assertRaises(LookupError, codecs.getreader, "__spam__")
# TODO: RUSTPYTHON if sys.platform == "win32": test_getreader = unittest.expectedFailure(test_getreader)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_getwriter(self): self.assertRaises(TypeError, codecs.getwriter) self.assertRaises(LookupError, codecs.getwriter, "__spam__")
# TODO: RUSTPYTHON if sys.platform == "win32": test_getwriter = unittest.expectedFailure(test_getwriter)
def test_lookup_issue1813(self): # Issue #1813: under Turkish locales, lookup of some codecs failed # because 'I' is lowercased as "ı" (dotless i) Expand Down Expand Up @@ -1926,6 +1905,7 @@ def test_undefined(self): self.assertRaises(UnicodeError, codecs.decode, b'abc', 'undefined', errors)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_file_closes_if_lookup_error_raised(self): mock_open = mock.mock_open() with mock.patch('builtins.open', mock_open) as file: Expand All @@ -1934,11 +1914,6 @@ def test_file_closes_if_lookup_error_raised(self):
file().close.assert_called()
# TODO: RUSTPYTHON if sys.platform == "win32": test_file_closes_if_lookup_error_raised = unittest.expectedFailure(test_file_closes_if_lookup_error_raised)

class StreamReaderTest(unittest.TestCase):
def setUp(self): Expand Down Expand Up @@ -3190,51 +3165,37 @@ def raise_obj(*args, **kwds): with self.assertRaisesRegex(RuntimeError, msg): codecs.decode(b"bytes input", self.codec_name)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_init_override_is_not_wrapped(self): class CustomInit(RuntimeError): def __init__(self): pass self.check_not_wrapped(CustomInit, "")
# TODO: RUSTPYTHON if sys.platform == "win32": test_init_override_is_not_wrapped = unittest.expectedFailure(test_init_override_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_new_override_is_not_wrapped(self): class CustomNew(RuntimeError): def __new__(cls): return super().__new__(cls) self.check_not_wrapped(CustomNew, "")
# TODO: RUSTPYTHON if sys.platform == "win32": test_new_override_is_not_wrapped = unittest.expectedFailure(test_new_override_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_instance_attribute_is_not_wrapped(self): msg = "This should NOT be wrapped" exc = RuntimeError(msg) exc.attr = 1 self.check_not_wrapped(exc, "^{}$".format(msg))
# TODO: RUSTPYTHON if sys.platform == "win32": test_instance_attribute_is_not_wrapped = unittest.expectedFailure(test_instance_attribute_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_non_str_arg_is_not_wrapped(self): self.check_not_wrapped(RuntimeError(1), "1")
# TODO: RUSTPYTHON if sys.platform == "win32": test_non_str_arg_is_not_wrapped = unittest.expectedFailure(test_non_str_arg_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") def test_multiple_args_is_not_wrapped(self): msg_re = r"^\('a', 'b', 'c'\)$" self.check_not_wrapped(RuntimeError('a', 'b', 'c'), msg_re)
# TODO: RUSTPYTHON if sys.platform == "win32": test_multiple_args_is_not_wrapped = unittest.expectedFailure(test_multiple_args_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON") # http://bugs.python.org/issue19609 def test_codec_lookup_failure_not_wrapped(self): msg = "^unknown encoding: {}$".format(self.codec_name) Expand All @@ -3248,10 +3209,6 @@ def test_codec_lookup_failure_not_wrapped(self): with self.assertRaisesRegex(LookupError, msg): codecs.decode(b"bytes input", self.codec_name)
# TODO: RUSTPYTHON if sys.platform == "win32": test_codec_lookup_failure_not_wrapped = unittest.expectedFailure(test_codec_lookup_failure_not_wrapped)
# TODO: RUSTPYTHON @unittest.expectedFailure def test_unflagged_non_text_codec_handling(self): Expand Down