Disable failing tests from test_bytes.py

This commit is contained in:
Jeong YunWon
2020-03-13 10:19:42 +09:00
parent 2cd67c7d74
commit ef1815a4ca
2 changed files with 132 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ class BaseTest:
args = self.fixtype(args)
getattr(obj, methodname)(*args)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_count(self):
self.checkequal(3, 'aaa', 'count', 'a')
self.checkequal(0, 'aaa', 'count', 'b')
@@ -156,6 +157,7 @@ class BaseTest:
self.assertEqual(rem, 0, '%s != 0 for %s' % (rem, i))
self.assertEqual(r1, r2, '%s != %s for %s' % (r1, r2, i))
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_find(self):
self.checkequal(0, 'abcdefghiabc', 'find', 'abc')
self.checkequal(9, 'abcdefghiabc', 'find', 'abc', 1)
@@ -213,6 +215,7 @@ class BaseTest:
if loc != -1:
self.assertEqual(i[loc:loc+len(j)], j)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_rfind(self):
self.checkequal(9, 'abcdefghiabc', 'rfind', 'abc')
self.checkequal(12, 'abcdefghiabc', 'rfind', '')
@@ -291,6 +294,7 @@ class BaseTest:
else:
self.checkraises(TypeError, 'hello', 'index', 42)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_rindex(self):
self.checkequal(12, 'abcdefghiabc', 'rindex', '')
self.checkequal(3, 'abcdefghiabc', 'rindex', 'def')
@@ -356,6 +360,7 @@ class BaseTest:
self.checkraises(OverflowError,
'\ta\n\tb', 'expandtabs', sys.maxsize)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_split(self):
# by a char
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'split', '|')
@@ -426,6 +431,7 @@ class BaseTest:
self.checkraises(ValueError, 'hello', 'split', '')
self.checkraises(ValueError, 'hello', 'split', '', 0)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_rsplit(self):
# by a char
self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|')
@@ -496,6 +502,7 @@ class BaseTest:
self.checkraises(ValueError, 'hello', 'rsplit', '')
self.checkraises(ValueError, 'hello', 'rsplit', '', 0)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_replace(self):
EQ = self.checkequal
@@ -770,6 +777,7 @@ class BaseTest:
self.checkequal(['arf', 'barf'], b, 'rsplit', None)
self.checkequal(['arf', 'barf'], b, 'rsplit', None, 2)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_strip_whitespace(self):
self.checkequal('hello', ' hello ', 'strip')
self.checkequal('hello ', ' hello ', 'lstrip')
@@ -787,6 +795,7 @@ class BaseTest:
self.checkequal(' hello', ' hello ', 'rstrip', None)
self.checkequal('hello', 'hello', 'strip', None)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_strip(self):
# strip/lstrip/rstrip with str arg
self.checkequal('hello', 'xyzzyhelloxyzzy', 'strip', 'xyz')
@@ -831,6 +840,7 @@ class BaseTest:
self.checkraises(TypeError, 'hello', 'swapcase', 42)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_zfill(self):
self.checkequal('123', '123', 'zfill', 2)
self.checkequal('123', '123', 'zfill', 3)
@@ -847,6 +857,7 @@ class BaseTest:
self.checkraises(TypeError, '123', 'zfill')
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_islower(self):
self.checkequal(False, '', 'islower')
self.checkequal(True, 'a', 'islower')
@@ -857,6 +868,7 @@ class BaseTest:
self.checkequal(True, 'abc\n', 'islower')
self.checkraises(TypeError, 'abc', 'islower', 42)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_isupper(self):
self.checkequal(False, '', 'isupper')
self.checkequal(False, 'a', 'isupper')
@@ -913,6 +925,7 @@ class BaseTest:
self.checkequal(False, 'abc\n', 'isalnum')
self.checkraises(TypeError, 'abc', 'isalnum', 42)
@unittest.skip("TODO: RUSTPYTHON test_bytes")
def test_isascii(self):
self.checkequal(True, '', 'isascii')
self.checkequal(True, '\x00', 'isascii')

View File

@@ -54,6 +54,8 @@ class BaseBytesTest:
self.assertEqual(a, b)
self.assertEqual(type(a), type(b))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_empty_sequence(self):
b = self.type2test()
self.assertEqual(len(b), 0)
@@ -113,6 +115,8 @@ class BaseBytesTest:
b = self.type2test([1, 2, 3])
self.assertEqual(b, b"\x01\x02\x03")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_from_mutating_list(self):
# Issue #34973: Crash in bytes constructor with mutating list.
class X:
@@ -130,6 +134,8 @@ class BaseBytesTest:
a = [Y()]
self.assertEqual(bytes(a), b'*' * 1000) # should not crash
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_from_index(self):
b = self.type2test([Indexable(), Indexable(1), Indexable(254),
Indexable(255)])
@@ -151,6 +157,7 @@ class BaseBytesTest:
self.assertEqual(self.type2test(B(b"foobar")), b"foobar")
@unittest.skip("TODO: RUSTPYTHON")
def test_from_ssize(self):
self.assertEqual(self.type2test(0), b'')
self.assertEqual(self.type2test(1), b'\x00')
@@ -161,6 +168,8 @@ class BaseBytesTest:
self.assertEqual(self.type2test(b'0'), b'0')
self.assertRaises(OverflowError, self.type2test, sys.maxsize + 1)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_constructor_type_errors(self):
self.assertRaises(TypeError, self.type2test, 0.0)
class C:
@@ -192,6 +201,8 @@ class BaseBytesTest:
self.assertRaises(ValueError, self.type2test, [sys.maxsize+1])
self.assertRaises(ValueError, self.type2test, [10**100])
# TODO: RUSTPYTHON
@unittest.expectedFailure
@bigaddrspacetest
def test_constructor_overflow(self):
size = MAX_Py_ssize_t
@@ -203,6 +214,8 @@ class BaseBytesTest:
except (OverflowError, MemoryError):
pass
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_constructor_exceptions(self):
# Issue #34974: bytes and bytearray constructors replace unexpected
# exceptions.
@@ -292,6 +305,8 @@ class BaseBytesTest:
for step in indices[1:]:
self.assertEqual(b[start:stop:step], self.type2test(L[start:stop:step]))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_encoding(self):
sample = "Hello world\n\u1234\u5678\u9abc"
for enc in ("utf-8", "utf-16"):
@@ -301,6 +316,8 @@ class BaseBytesTest:
b = self.type2test(sample, "latin-1", "ignore")
self.assertEqual(b, self.type2test(sample[:-3], "utf-8"))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_decode(self):
sample = "Hello world\n\u1234\u5678\u9abc"
for enc in ("utf-8", "utf-16"):
@@ -332,6 +349,7 @@ class BaseBytesTest:
self.assertRaises(TypeError, lambda: b1 + "def")
self.assertRaises(TypeError, lambda: "abc" + b2)
@unittest.skip("TODO: RUSTPYTHON")
def test_repeat(self):
for b in b"abc", self.type2test(b"abc"):
self.assertEqual(b * 3, b"abcabcabc")
@@ -372,6 +390,8 @@ class BaseBytesTest:
self.assertNotIn(f(b"dab"), b)
self.assertNotIn(f(b"abd"), b)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_fromhex(self):
self.assertRaises(TypeError, self.type2test.fromhex)
self.assertRaises(TypeError, self.type2test.fromhex, 1)
@@ -409,6 +429,8 @@ class BaseBytesTest:
self.type2test.fromhex(data)
self.assertIn('at position %s' % pos, str(cm.exception))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_hex(self):
self.assertRaises(TypeError, self.type2test.hex)
self.assertRaises(TypeError, self.type2test.hex, 1)
@@ -417,6 +439,8 @@ class BaseBytesTest:
self.assertEqual(self.type2test(b"\x1a\x2b\x30").hex(), '1a2b30')
self.assertEqual(memoryview(b"\x1a\x2b\x30").hex(), '1a2b30')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_hex_separator_basics(self):
three_bytes = self.type2test(b'\xb9\x01\xef')
self.assertEqual(three_bytes.hex(), 'b901ef')
@@ -458,6 +482,8 @@ class BaseBytesTest:
five_bytes = self.type2test(range(90,95))
self.assertEqual(five_bytes.hex(), '5a5b5c5d5e')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_hex_separator_six_bytes(self):
six_bytes = self.type2test(x*3 for x in range(1, 7))
self.assertEqual(six_bytes.hex(), '0306090c0f12')
@@ -523,6 +549,8 @@ class BaseBytesTest:
self.assertEqual(b.count(i, 1, 3), 1)
self.assertEqual(b.count(p, 7, 9), 1)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_startswith(self):
b = self.type2test(b'hello')
self.assertFalse(self.type2test().startswith(b"anything"))
@@ -537,6 +565,8 @@ class BaseBytesTest:
self.assertIn('bytes', exc)
self.assertIn('tuple', exc)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_endswith(self):
b = self.type2test(b'hello')
self.assertFalse(bytearray().endswith(b"anything"))
@@ -576,6 +606,8 @@ class BaseBytesTest:
ValueError, r'byte must be in range\(0, 256\)',
b.find, index)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_rfind(self):
b = self.type2test(b'mississippi')
i = 105
@@ -615,6 +647,8 @@ class BaseBytesTest:
self.assertEqual(b.index(i, 1, 3), 1)
self.assertRaises(ValueError, b.index, w, 1, 3)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_rindex(self):
b = self.type2test(b'mississippi')
i = 105
@@ -634,6 +668,8 @@ class BaseBytesTest:
self.assertEqual(b.rindex(i, 3, 9), 7)
self.assertRaises(ValueError, b.rindex, w, 1, 3)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_mod(self):
b = self.type2test(b'hello, %b!')
orig = b
@@ -651,6 +687,8 @@ class BaseBytesTest:
self.assertEqual(b, b'hello,\x00world!')
self.assertIs(type(b), self.type2test)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_imod(self):
b = self.type2test(b'hello, %b!')
orig = b
@@ -689,6 +727,8 @@ class BaseBytesTest:
self.assertRaises(TypeError, self.type2test(b'a b').split, 32)
self.assertRaises(TypeError, self.type2test(b'a b').rsplit, 32)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_split_unicodewhitespace(self):
for b in (b'a\x1Cb', b'a\x1Db', b'a\x1Eb', b'a\x1Fb'):
b = self.type2test(b)
@@ -696,15 +736,19 @@ class BaseBytesTest:
b = self.type2test(b"\x09\x0A\x0B\x0C\x0D\x1C\x1D\x1E\x1F")
self.assertEqual(b.split(), [b'\x1c\x1d\x1e\x1f'])
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_rsplit_unicodewhitespace(self):
b = self.type2test(b"\x09\x0A\x0B\x0C\x0D\x1C\x1D\x1E\x1F")
self.assertEqual(b.rsplit(), [b'\x1c\x1d\x1e\x1f'])
@unittest.skip("TODO: RUSTPYTHON")
def test_partition(self):
b = self.type2test(b'mississippi')
self.assertEqual(b.partition(b'ss'), (b'mi', b'ss', b'issippi'))
self.assertEqual(b.partition(b'w'), (b'mississippi', b'', b''))
@unittest.skip("TODO: RUSTPYTHON")
def test_rpartition(self):
b = self.type2test(b'mississippi')
self.assertEqual(b.rpartition(b'ss'), (b'missi', b'ss', b'ippi'))
@@ -719,6 +763,8 @@ class BaseBytesTest:
self.assertRaises(TypeError, self.type2test(b'a b').partition, 32)
self.assertRaises(TypeError, self.type2test(b'a b').rpartition, 32)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0":
@@ -727,6 +773,8 @@ class BaseBytesTest:
q = pickle.loads(ps)
self.assertEqual(b, q)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_iterator_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0":
@@ -786,11 +834,15 @@ class BaseBytesTest:
self.assertRaises(TypeError, self.type2test(b'abc').ljust, 7, 32)
self.assertRaises(TypeError, self.type2test(b'abc').rjust, 7, 32)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_ord(self):
b = self.type2test(b'\0A\x7f\x80\xff')
self.assertEqual([ord(b[i:i+1]) for i in range(len(b))],
[0, 65, 127, 128, 255])
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_maketrans(self):
transtable = b'\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
self.assertEqual(self.type2test.maketrans(b'abc', b'xyz'), transtable)
@@ -799,6 +851,7 @@ class BaseBytesTest:
self.assertRaises(ValueError, self.type2test.maketrans, b'abc', b'xyzq')
self.assertRaises(TypeError, self.type2test.maketrans, 'abc', 'def')
@unittest.skip("TODO: RUSTPYTHON")
def test_none_arguments(self):
# issue 11828
b = self.type2test(b'hello')
@@ -850,6 +903,8 @@ class BaseBytesTest:
self.assertRaises(ValueError, method, 256)
self.assertRaises(ValueError, method, 9999)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_find_etc_raise_correct_error_messages(self):
# issue 11828
b = self.type2test(b'hello')
@@ -869,6 +924,8 @@ class BaseBytesTest:
self.assertRaisesRegex(TypeError, r'\bendswith\b', b.endswith,
x, None, None, None)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_free_after_iterating(self):
test.support.check_free_after_iterating(self, iter, self.type2test)
test.support.check_free_after_iterating(self, reversed, self.type2test)
@@ -908,17 +965,23 @@ class BaseBytesTest:
class BytesTest(BaseBytesTest, unittest.TestCase):
type2test = bytes
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_getitem_error(self):
b = b'python'
msg = "byte indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
b['a']
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_buffer_is_readonly(self):
fd = os.open(__file__, os.O_RDONLY)
with open(fd, "rb", buffering=0) as f:
self.assertRaises(TypeError, f.readinto, b"")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_custom(self):
class A:
def __bytes__(self):
@@ -1065,6 +1128,8 @@ class BytesTest(BaseBytesTest, unittest.TestCase):
self.assertEqual(PyBytes_FromFormat(b'%s', b''),
b'')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_bytes_blocking(self):
class IterationBlocked(list):
__bytes__ = None
@@ -1099,12 +1164,16 @@ class BytesTest(BaseBytesTest, unittest.TestCase):
class ByteArrayTest(BaseBytesTest, unittest.TestCase):
type2test = bytearray
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_getitem_error(self):
b = bytearray(b'python')
msg = "bytearray indices must be integers or slices"
with self.assertRaisesRegex(TypeError, msg):
b['a']
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_setitem_error(self):
b = bytearray(b'python')
msg = "bytearray indices must be integers or slices"
@@ -1114,6 +1183,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
def test_nohash(self):
self.assertRaises(TypeError, hash, bytearray())
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_bytearray_api(self):
short_sample = b"Hello world\n"
sample = short_sample + b"\0"*(20 - len(short_sample))
@@ -1184,12 +1255,16 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
self.assertEqual(bb, b'abcd')
self.assertEqual(b, b'abc')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_regexps(self):
def by(s):
return bytearray(map(ord, s))
b = by("Hello, world")
self.assertEqual(re.findall(br"\w+", b), [by("Hello"), by("world")])
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_setitem(self):
b = bytearray([1, 2, 3])
b[1] = 100
@@ -1233,6 +1308,7 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
del b[4]
self.assertEqual(b, bytearray([1, 2, 3, 4, 6, 7, 8]))
@unittest.skip("TODO: RUSTPYTHON")
def test_setslice(self):
b = bytearray(range(10))
self.assertEqual(list(b), list(range(10)))
@@ -1298,6 +1374,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
del b[:1]
self.assertLessEqual(sys.getsizeof(b), size)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_extended_set_del_slice(self):
indices = (0, None, 1, 3, 19, 300, 1<<333, sys.maxsize,
-1, -2, -31, -300)
@@ -1319,6 +1397,7 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
del b[start:stop:step]
self.assertEqual(b, bytearray(L))
@unittest.skip("TODO: RUSTPYTHON")
def test_setslice_trap(self):
# This test verifies that we correctly handle assigning self
# to a slice of self (the old Lambert Meertens trap).
@@ -1326,6 +1405,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
b[8:] = b
self.assertEqual(b, bytearray(list(range(8)) + list(range(256))))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_iconcat(self):
b = bytearray(b"abc")
b1 = b
@@ -1342,6 +1423,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
else:
self.fail("bytes += unicode didn't raise TypeError")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_irepeat(self):
b = bytearray(b"abc")
b1 = b
@@ -1350,6 +1433,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
self.assertEqual(b, b1)
self.assertIs(b, b1)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_irepeat_1char(self):
b = bytearray(b"x")
b1 = b
@@ -1358,6 +1443,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
self.assertEqual(b, b1)
self.assertIs(b, b1)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_alloc(self):
b = bytearray()
alloc = b.__alloc__()
@@ -1370,6 +1457,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
if alloc not in seq:
seq.append(alloc)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_init_alloc(self):
b = bytearray()
def g():
@@ -1387,6 +1476,7 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
alloc = b.__alloc__()
self.assertGreater(alloc, len(b))
@unittest.skip("TODO: RUSTPYTHON")
def test_extend(self):
orig = b'hello'
a = bytearray(orig)
@@ -1415,6 +1505,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
a.extend([Indexable(ord('a'))])
self.assertEqual(a, b'a')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_remove(self):
b = bytearray(b'hello')
b.remove(ord('l'))
@@ -1439,6 +1531,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
c.remove(129)
self.assertEqual(c, bytes([126, 128]))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pop(self):
b = bytearray(b'world')
self.assertEqual(b.pop(), ord('d'))
@@ -1452,6 +1546,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
def test_nosort(self):
self.assertRaises(AttributeError, lambda: bytearray().sort())
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_append(self):
b = bytearray(b'hell')
b.append(ord('o'))
@@ -1465,6 +1561,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
b.append(Indexable(ord('A')))
self.assertEqual(b, b'A')
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_insert(self):
b = bytearray(b'msssspp')
b.insert(1, ord('i'))
@@ -1487,6 +1585,7 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
x = bytearray(b'')
self.assertIsNot(x, x.translate(t))
@unittest.skip("TODO: RUSTPYTHON")
def test_partition_bytearray_doesnt_share_nullstring(self):
a, b, c = bytearray(b"x").partition(b"y")
self.assertEqual(b, b"")
@@ -1508,6 +1607,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
self.assertEqual(b, b"")
self.assertEqual(c, b"")
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_resize_forbidden(self):
# #4509: can't resize a bytearray when there are buffer exports, even
# if it wouldn't reallocate the underlying buffer.
@@ -1545,6 +1646,8 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
from _testcapi import getbuffer_with_null_view
self.assertRaises(BufferError, getbuffer_with_null_view, bytearray())
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_iterator_pickling2(self):
orig = bytearray(b'abc')
data = list(b'qwerty')
@@ -1598,6 +1701,8 @@ class AssortedBytesTest(unittest.TestCase):
# Test various combinations of bytes and bytearray
#
# TODO: RUSTPYTHON
@unittest.expectedFailure
@check_bytes_warnings
def test_repr_str(self):
for f in str, repr:
@@ -1609,6 +1714,8 @@ class AssortedBytesTest(unittest.TestCase):
self.assertEqual(f(b"'"), '''b"'"''') # '''
self.assertEqual(f(b"'\""), r"""b'\'"'""") # '
# TODO: RUSTPYTHON
@unittest.expectedFailure
@check_bytes_warnings
def test_format(self):
for b in b'abc', bytearray(b'abc'):
@@ -1647,6 +1754,8 @@ class AssortedBytesTest(unittest.TestCase):
self.assertEqual(bytes(b"abc") < b"ab", False)
self.assertEqual(bytes(b"abc") <= b"ab", False)
# TODO: RUSTPYTHON
@unittest.expectedFailure
@test.support.requires_docstrings
def test_doc(self):
self.assertIsNotNone(bytearray.__doc__)
@@ -1742,6 +1851,8 @@ class BytearrayPEP3137Test(unittest.TestCase):
def marshal(self, x):
return bytearray(x)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_returns_new_copy(self):
val = self.marshal(b'1234')
# On immutable types these MAY return a reference to themselves
@@ -1819,6 +1930,8 @@ class SubclassTest:
s3 = s1.join([b"abcd"])
self.assertIs(type(s3), self.basetype)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickle(self):
a = self.type2test(b"abcd")
a.x = 10
@@ -1832,6 +1945,8 @@ class SubclassTest:
self.assertEqual(type(a), type(b))
self.assertEqual(type(a.y), type(b.y))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_copy(self):
a = self.type2test(b"abcd")
a.x = 10
@@ -1845,6 +1960,8 @@ class SubclassTest:
self.assertEqual(type(a), type(b))
self.assertEqual(type(a.y), type(b.y))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_fromhex(self):
b = self.type2test.fromhex('1a2B30')
self.assertEqual(b, b'\x1a\x2b\x30')
@@ -1886,6 +2003,8 @@ class ByteArraySubclassTest(SubclassTest, unittest.TestCase):
basetype = bytearray
type2test = ByteArraySubclass
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_init_override(self):
class subclass(bytearray):
def __init__(me, newarg=1, *args, **kwargs):