style: use Black everywhere (#2594)

* style: use Black everywhere

* style: minor touchup from review
This commit is contained in:
Henry Schreiner
2020-10-16 16:38:13 -04:00
committed by GitHub
parent 2e31e466dc
commit c50f90eca6
38 changed files with 1653 additions and 941 deletions

View File

@@ -46,8 +46,8 @@ def test_to_python():
mat[3, 2] = 7.0
assert mat[2, 3] == 4
assert mat[3, 2] == 7
assert struct.unpack_from('f', mat, (3 * 4 + 2) * 4) == (7, )
assert struct.unpack_from('f', mat, (2 * 4 + 3) * 4) == (4, )
assert struct.unpack_from("f", mat, (3 * 4 + 2) * 4) == (7,)
assert struct.unpack_from("f", mat, (2 * 4 + 3) * 4) == (4,)
mat2 = np.array(mat, copy=False)
assert mat2.shape == (5, 4)
@@ -83,31 +83,31 @@ def test_pointer_to_member_fn():
for cls in [m.Buffer, m.ConstBuffer, m.DerivedBuffer]:
buf = cls()
buf.value = 0x12345678
value = struct.unpack('i', bytearray(buf))[0]
value = struct.unpack("i", bytearray(buf))[0]
assert value == 0x12345678
def test_readonly_buffer():
buf = m.BufferReadOnly(0x64)
view = memoryview(buf)
assert view[0] == b'd' if env.PY2 else 0x64
assert view[0] == b"d" if env.PY2 else 0x64
assert view.readonly
def test_selective_readonly_buffer():
buf = m.BufferReadOnlySelect()
memoryview(buf)[0] = b'd' if env.PY2 else 0x64
memoryview(buf)[0] = b"d" if env.PY2 else 0x64
assert buf.value == 0x64
io.BytesIO(b'A').readinto(buf)
assert buf.value == ord(b'A')
io.BytesIO(b"A").readinto(buf)
assert buf.value == ord(b"A")
buf.readonly = True
with pytest.raises(TypeError):
memoryview(buf)[0] = b'\0' if env.PY2 else 0
memoryview(buf)[0] = b"\0" if env.PY2 else 0
with pytest.raises(TypeError):
io.BytesIO(b'1').readinto(buf)
io.BytesIO(b"1").readinto(buf)
def test_ctypes_array_1d():