-
Notifications
You must be signed in to change notification settings - Fork 0
fix: test error #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
| self.assertEqual('test', dm1.workout_step_name) | ||
|
|
||
| bytes1 = dm1.to_bytes() | ||
|
|
||
|
|
@@ -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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.assertEqual('test', dm2.workout_step_name) | ||
|
|
||
| self.assertEqual(bytes2, bytes1) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ def test_conversion_simple(self): | |
|
|
||
| print(f'{bytes1}') | ||
| print(f'{bytes2}') | ||
| self.assertEquals(bytes2, bytes1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.assertEqual(bytes2, bytes1) | ||
|
|
||
| def test_builder_with_auto_define(self): | ||
| mesg1 = WorkoutStepMessage(local_id=0) | ||
|
|
@@ -49,4 +49,4 @@ def test_builder_with_auto_define(self): | |
|
|
||
| fit_file = builder.build() | ||
|
|
||
| self.assertEquals(len(fit_file.records), 3) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.assertEqual(len(fit_file.records), 3) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
|
|
||
| import unittest | ||
|
|
||
| from fit_tool.fit import Profile | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| from fit_tool.gen.profile import Profile | ||
|
|
||
|
|
||
| class TestFitFile(unittest.TestCase): | ||
|
|
||
| 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 | ||
|
|
@@ -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' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| 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. | ||
|
|
@@ -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' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| csv_path = os.path.join(TEST_DIR, 'out', 'activity_with_developer_data.csv') | ||
| fit_file.to_csv(csv_path) | ||
|
|
||
| # read back the file | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method
assertEqualsis deprecated. UseassertEqualinstead.