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
4 changes: 2 additions & 2 deletions fit_tool/tests/test_data_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def shortDescription(self):
def test_data_message_conversions(self):
dm1 = WorkoutStepMessage()
dm1.workout_step_name = 'test'
self.assertEquals('test', dm1.workout_step_name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method assertEquals is deprecated. Use assertEqual instead.

Suggested change
self.assertEquals('test', dm1.workout_step_name)
self.assertEqual('test', dm1.workout_step_name)

self.assertEqual('test', dm1.workout_step_name)

bytes1 = dm1.to_bytes()

Expand All @@ -24,7 +24,7 @@ def test_data_message_conversions(self):
dm2.read_from_bytes(bytes1)
bytes2 = dm2.to_bytes()

self.assertEquals('test', dm2.workout_step_name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method assertEquals is deprecated. Use assertEqual instead.

Suggested change
self.assertEquals('test', dm2.workout_step_name)
self.assertEqual('test', dm2.workout_step_name)

self.assertEqual('test', dm2.workout_step_name)

self.assertEqual(bytes2, bytes1)

Expand Down
4 changes: 2 additions & 2 deletions fit_tool/tests/test_fit_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_conversion_simple(self):

print(f'{bytes1}')
print(f'{bytes2}')
self.assertEquals(bytes2, bytes1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method assertEquals is deprecated. Use assertEqual instead.

Suggested change
self.assertEquals(bytes2, bytes1)
self.assertEqual(bytes2, bytes1)

self.assertEqual(bytes2, bytes1)

def test_builder_with_auto_define(self):
mesg1 = WorkoutStepMessage(local_id=0)
Expand All @@ -49,4 +49,4 @@ def test_builder_with_auto_define(self):

fit_file = builder.build()

self.assertEquals(len(fit_file.records), 3)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method assertEquals is deprecated. Use assertEqual instead.

Suggested change
self.assertEquals(len(fit_file.records), 3)
self.assertEqual(len(fit_file.records), 3)

self.assertEqual(len(fit_file.records), 3)
2 changes: 1 addition & 1 deletion fit_tool/tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest

from fit_tool.fit import Profile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Changing the import path to fit_tool.gen.profile to import the Profile class.

Suggested change
from fit_tool.fit import Profile
from fit_tool.gen.profile import Profile

from fit_tool.gen.profile import Profile


class TestFitFile(unittest.TestCase):
Expand Down
4 changes: 4 additions & 0 deletions fit_tool/tests/test_sdk_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import os
import unittest

TEST_DIR = os.path.dirname(__file__)
OUT_DIR = os.path.join(TEST_DIR, 'out')
os.makedirs(OUT_DIR, exist_ok=True)

from fit_tool.fit_file import FitFile


Expand Down
11 changes: 8 additions & 3 deletions fit_tool/tests/test_write_activity_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import datetime
import os
import struct
import unittest

TEST_DIR = os.path.dirname(__file__)
OUT_DIR = os.path.join(TEST_DIR, 'out')
os.makedirs(OUT_DIR, exist_ok=True)

from fit_tool.base_type import BaseType
from fit_tool.definition_message import DefinitionMessage
from fit_tool.developer_field import DeveloperField
Expand Down Expand Up @@ -47,7 +52,7 @@ def write_message(message_: Message):
records_size += len(buffer_)
records_crc = crc16(buffer_, crc=records_crc)

out_path = '../tests/out/activity_iterative.fit'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using os.path.join to construct the file path for better cross-platform compatibility.

Suggested change
out_path = '../tests/out/activity_iterative.fit'
out_path = os.path.join(TEST_DIR, 'out', 'activity_iterative.fit')

out_path = os.path.join(TEST_DIR, 'out', 'activity_iterative.fit')
with open(out_path, 'wb') as file_object:
# Create a placeholder 14 byte header (includes a crc). We overwrite these bytes after all the records
# have been written.
Expand Down Expand Up @@ -171,10 +176,10 @@ def test_write_activity_with_developer_data_fields(self):
# Finally build the FIT file object and write it to a file
fit_file = builder.build()

out_path = '../tests/out/activity_with_developer_data.fit'
out_path = os.path.join(TEST_DIR, 'out', 'activity_with_developer_data.fit')

fit_file.to_file(out_path)
csv_path = '../tests/out/activity_with_developer_data.csv'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using os.path.join to construct the file path for better cross-platform compatibility.

Suggested change
csv_path = '../tests/out/activity_with_developer_data.csv'
out_path = os.path.join(TEST_DIR, 'out', 'activity_with_developer_data.fit')

csv_path = os.path.join(TEST_DIR, 'out', 'activity_with_developer_data.csv')
fit_file.to_csv(csv_path)

# read back the file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using os.path.join to construct the file path for better cross-platform compatibility.

Suggested change
# read back the file
csv_path = os.path.join(TEST_DIR, 'out', 'activity_with_developer_data.csv')

Expand Down