Skip to content

fix: test error#2

Merged
shaonianche merged 2 commits intomainfrom
fix/test-errors
Jan 28, 2026
Merged

fix: test error#2
shaonianche merged 2 commits intomainfrom
fix/test-errors

Conversation

@shaonianche
Copy link
Copy Markdown
Owner

No description provided.

Signed-off-by: friendsa <github@duanfei.org>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shaonianche, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the stability and compatibility of the test suite. It addresses minor issues by updating deprecated assertion methods in Python's unittest framework, improving the robustness of file path handling in tests for cross-platform consistency, and correcting an import statement for a refactored class. These changes collectively ensure the tests function reliably and adhere to current best practices.

Highlights

  • Test Assertion Updates: Replaced deprecated self.assertEquals with self.assertEqual in several test files (test_data_message.py, test_fit_file.py) to align with modern Python unittest practices.
  • Test File Path Handling: Refactored test output file path generation in test_write_activity_file.py to use os.path.join and a TEST_DIR variable, ensuring platform-independent path construction.
  • Import Path Correction: Updated the import path for the Profile class in test_profile.py from fit_tool.fit to fit_tool.gen.profile, reflecting a likely refactoring of the class's location.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Signed-off-by: friendsa <github@duanfei.org>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request involves replacing assertEquals with assertEqual in the test files and updating the import path for Profile in test_profile.py. Additionally, it modifies the file paths in test_write_activity_file.py to use os.path.join for better cross-platform compatibility. The changes appear to improve code clarity and maintainability.

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)

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)


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)


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)


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

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_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')

@shaonianche shaonianche merged commit f477742 into main Jan 28, 2026
6 checks passed
shaonianche added a commit that referenced this pull request Feb 5, 2026
Enhance CI workflow to include coverage reporting in pytest tests #2
@shaonianche shaonianche deleted the fix/test-errors branch February 26, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant