Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file added tests/files/nametest.FIT
Binary file not shown.
20 changes: 12 additions & 8 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,19 @@ def test_int_long(self):
assert f.messages[-1].fields[1].raw_value == 1739.486328125

def test_fileish_types(self):
"""Test the constructor does the right thing when given different types"""
with FitFile(testfile('Settings.FIT')):
pass
with FitFile(open(testfile("Settings.fit"), 'rb')):
pass
with FitFile(open(testfile("Settings.fit"), 'rb').read()):
pass
with FitFile(io.BytesIO(open(testfile("Settings.fit"), 'rb').read())):
"""Test the constructor does the right thing when given different types
(specifically, test files with 8 characters, followed by an uppercase.FIT
extension), which confused the fileish check on Python 2, see
https://github.com/dtcooper/python-fitparse/issues/29#issuecomment-312436350
for details"""
with FitFile(testfile('nametest.FIT')):
pass
with open(testfile("nametest.FIT"), 'rb') as f:
FitFile(f)
with open(testfile("nametest.FIT"), 'rb') as f:
FitFile(f.read())
with open(testfile("nametest.FIT"), 'rb') as f:
FitFile(io.BytesIO(f.read()))

def test_elemnt_bolt_developer_data_id_without_application_id(self):
"""Test that a file without application id set inside developer_data_id is parsed
Expand Down