Skip to content

Commit 360f8ca

Browse files
committed
Reaaply patches to test_bytes.py
1 parent 9b400a9 commit 360f8ca

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Lib/test/test_bytes.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,11 @@ def test_irepeat_1char(self):
15791579
self.assertEqual(b, b1)
15801580
self.assertIs(b, b1)
15811581

1582+
# NOTE: RUSTPYTHON:
1583+
#
1584+
# The second instance of self.assertGreater was replaced with
1585+
# self.assertGreaterEqual since, in RustPython, the underlying storage
1586+
# is a Vec which doesn't require trailing null byte.
15821587
def test_alloc(self):
15831588
b = bytearray()
15841589
alloc = b.__alloc__()
@@ -1587,10 +1592,15 @@ def test_alloc(self):
15871592
for i in range(100):
15881593
b += b"x"
15891594
alloc = b.__alloc__()
1590-
self.assertGreater(alloc, len(b)) # including trailing null byte
1595+
self.assertGreaterEqual(alloc, len(b)) # NOTE: RUSTPYTHON patched
15911596
if alloc not in seq:
15921597
seq.append(alloc)
15931598

1599+
# NOTE: RUSTPYTHON:
1600+
#
1601+
# The usages of self.assertGreater were replaced with
1602+
# self.assertGreaterEqual since, in RustPython, the underlying storage
1603+
# is a Vec which doesn't require trailing null byte.
15941604
def test_init_alloc(self):
15951605
b = bytearray()
15961606
def g():
@@ -1601,12 +1611,12 @@ def g():
16011611
self.assertEqual(len(b), len(a))
16021612
self.assertLessEqual(len(b), i)
16031613
alloc = b.__alloc__()
1604-
self.assertGreater(alloc, len(b)) # including trailing null byte
1614+
self.assertGreaterEqual(alloc, len(b)) # NOTE: RUSTPYTHON patched
16051615
b.__init__(g())
16061616
self.assertEqual(list(b), list(range(1, 100)))
16071617
self.assertEqual(len(b), 99)
16081618
alloc = b.__alloc__()
1609-
self.assertGreater(alloc, len(b))
1619+
self.assertGreaterEqual(alloc, len(b)) # NOTE: RUSTPYTHON patched
16101620

16111621
def test_extend(self):
16121622
orig = b'hello'

0 commit comments

Comments
 (0)