Skip to content

Conversation

Ben-geo
Copy link
Collaborator

@Ben-geo Ben-geo commented Mar 14, 2025

  • i just added a step counter
  • added tests as well
    @adamamer20

Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (main@3e4d349). Learn more about missing BASE report.

Files with missing lines Patch % Lines
mesa_frames/concrete/model.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #117   +/-   ##
=======================================
  Coverage        ?   91.29%           
=======================================
  Files           ?       14           
  Lines           ?     2217           
  Branches        ?        0           
=======================================
  Hits            ?     2024           
  Misses          ?      193           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adamamer20
Copy link
Member

adamamer20 commented Mar 15, 2025

It's almost there, @Ben-geo! However, please have a look at the Mesa implementation for reference:
https://github.com/projectmesa/mesa/pull/2223/files#diff-880be5fe544f98fbaa276ae26b660d15492e3c2865bac48beee670836bd87480R80-R89

In mesa implementation, the step method is wrapped to ensure the step counter increments correctly. With your current approach, if a user defines their own step method, it overrides the ModelDF implementation, preventing the counter from incrementing.

@Ben-geo
Copy link
Collaborator Author

Ben-geo commented Mar 15, 2025

@adamamer20 I hope this works !
the tests look fine too

@adamamer20 adamamer20 self-requested a review March 16, 2025 12:13
Copy link
Member

@adamamer20 adamamer20 left a comment

Choose a reason for hiding this comment

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

Perfect, this is fine

@adamamer20 adamamer20 added feature New functionality added to the project. testing Additions or modifications to test files. labels Mar 16, 2025
@adamamer20 adamamer20 added this to the 0.1.0-stable milestone Mar 16, 2025
@adamamer20 adamamer20 linked an issue Mar 16, 2025 that may be closed by this pull request
@adamamer20
Copy link
Member

This pull request introduces a new step counter feature to the ModelDF class and adds corresponding tests. The main changes include adding a step counter, modifying the step method to increment the counter, and adding tests to verify the new functionality.

Enhancements to ModelDF class:

  • mesa_frames/concrete/model.py: Introduced a new private attribute _steps to keep track of the step count and added a property steps to retrieve the current step count. Modified the step method to increment the step counter automatically by wrapping the user-defined step method. [1] [2]

Testing the new step counter:

  • tests/test_modeldf.py: Added a new test class Test_ModelDF to verify the functionality of the step counter. This includes tests for the default step counter behavior and custom user-defined step behavior.

@adamamer20 adamamer20 merged commit 9db99c9 into projectmesa:main Mar 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality added to the project. testing Additions or modifications to test files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Automatic increase of step counter
2 participants