Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address review: add complex test to test_compare_equal()
  • Loading branch information
skirpichev committed Mar 25, 2026
commit a728a1badd30f38d7048c03ea0f64ad465d5b0e9
12 changes: 12 additions & 0 deletions Lib/test/test_memoryview.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,18 @@ def check_equal(view, is_equal):
m = memoryview(a)
check_equal(m, True)

Comment thread
skirpichev marked this conversation as resolved.
# Test complex formats
for complex_format in 'FD':
with self.subTest(format=complex_format):
data = struct.pack(complex_format * 3, 1.0, 2.0, float('nan'))
m = memoryview(data).cast(complex_format)
# nan is not equal to nan
check_equal(m, False)

data = struct.pack(complex_format * 3, 1.0, 2.0, 3.0)
m = memoryview(data).cast(complex_format)
check_equal(m, True)


class BytesMemorySliceTest(unittest.TestCase,
BaseMemorySliceTests, BaseBytesMemoryTests):
Expand Down
Loading