Skip to content

Commit

Permalink
Fix numpy deprecation warnings (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreeve committed Sep 18, 2021
1 parent 15c3fba commit 1d53065
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions nptdms/test/test_tdms_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from nptdms.test import scenarios


if sys.platform == "darwin":
# MacOS tests often take longer to run initially on GitHub actions
settings.register_profile('macos', deadline=5000)
settings.load_profile('macos')
# When running tests on GitHub actions, the first iteration can be quite
# slow and cause failures, so disable deadlines:
settings.register_profile('ci', deadline=None)
settings.load_profile('ci')


@pytest.mark.parametrize("test_file,expected_data", scenarios.get_scenarios())
Expand Down
4 changes: 4 additions & 0 deletions nptdms/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ class Boolean(StructType):
size = 1
struct_declaration = "b"

def __init__(self, value):
self.value = bool(value)
self.bytes = _struct_pack('<' + self.struct_declaration, self.value)

@classmethod
def read(cls, file, endianness="<"):
return bool(super(Boolean, cls).read(file, endianness))
Expand Down
3 changes: 1 addition & 2 deletions nptdms/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ def to_file(file, array):
try:
array.tofile(file)
except (TypeError, IOError, UnsupportedOperation):
# tostring actually returns bytes
file.write(array.tostring())
file.write(array.tobytes())


def write_values(file, array):
Expand Down

0 comments on commit 1d53065

Please sign in to comment.