Skip to content

Conversation

@Routhleck
Copy link
Collaborator

This pull request introduces a new decorator function assign_units in the brainunit module to handle unit transformations for function arguments and return values. It also includes tests for this new functionality. The most important changes include adding the assign_units function, updating the _base.py file to include the new decorator, and adding corresponding tests.

New functionality for unit transformation:

  • Added assign_units decorator function to transform units of arguments passed to a function. (brainunit/_base.py)

Codebase updates:

  • Included assign_units in the list of functions for checking units. (brainunit/_base.py)
  • Added _assign_unit helper function to handle unit assignment within the assign_units decorator. (brainunit/_base.py)

Testing:

  • Added test_assign_units method to test various scenarios for the assign_units decorator, ensuring it correctly handles unit transformations and raises appropriate errors. (brainunit/_base_test.py)

@Routhleck
Copy link
Collaborator Author

#72

Copy link
Member

@chaoming0625 chaoming0625 left a comment

Choose a reason for hiding this comment

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

Great.

@chaoming0625 chaoming0625 merged commit a840d6c into main Dec 4, 2024
24 checks passed
@chaoming0625 chaoming0625 deleted the assign-units branch December 4, 2024 08:27
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.

3 participants