Skip to content

Conversation

@pragam-m25
Copy link
Contributor

@pragam-m25 pragam-m25 commented Nov 2, 2025

Description

This PR adds a new test to test_solara_viz_updated.py for the UserInputs component for the InputText type.

This improves the test coverage for this component.

Related Issue

Addresses part of #1781

Checklist

  • I have read and agree to the Code of Conduct.
  • I have read the contributing guidelines.
  • I have added tests for my changes.
  • I have updated the documentation if necessary.
  • All tests pass.
  • My code follows the code style of this project.

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +1.0% [+0.3%, +1.7%] 🔵 -0.5% [-0.7%, -0.4%]
BoltzmannWealth large 🔵 -0.3% [-0.8%, +0.1%] 🔵 +0.9% [-0.5%, +2.4%]
Schelling small 🔵 -0.1% [-0.3%, +0.1%] 🔵 -0.6% [-0.9%, -0.3%]
Schelling large 🔵 +0.2% [-0.1%, +0.6%] 🔵 -0.5% [-1.5%, +0.6%]
WolfSheep small 🔵 -0.3% [-0.6%, +0.0%] 🔵 -0.2% [-0.3%, -0.0%]
WolfSheep large 🔵 -0.4% [-1.2%, +0.3%] 🔵 -0.2% [-0.5%, +0.2%]
BoidFlockers small 🔵 +3.7% [+2.6%, +4.7%] 🔵 -0.3% [-0.5%, -0.1%]
BoidFlockers large 🔴 +3.5% [+3.2%, +4.0%] 🔵 -0.6% [-0.8%, -0.4%]

@pragam-m25
Copy link
Contributor Author

Hi mentors, I've fixed the pre-commit issues and all checks are passing now. Ready for review when you have time!

@Sahil-Chhoker
Copy link
Collaborator

@pragam-m25 PR is appreciated but we already have tests for checkbox here. I didn't know that we are missing the test for InputText field, but this is not the proper file and location for this test, you should add the test to the TestMakeUserInput class of test_solara_viz_updated.py.

image

Also what gives you the idea that hinglish(hindi written in english) is an acceptable language for the comments?

image

Also the function name is very convoluted, it can be something simple like test_input_text_field

@EwoutH EwoutH added the testing Release notes label label Nov 2, 2025
@EwoutH EwoutH requested a review from Sahil-Chhoker November 2, 2025 09:06
@EwoutH
Copy link
Member

EwoutH commented Nov 2, 2025

Hi, thanks for opening a PR!

Could you motivatie why you added these two specific tests?

Also you deleted our PR template, we have that for a reason, to answer these kinds of questions. Please follow it. :)

@pragam-m25
Copy link
Contributor Author

Hi @EwoutH
Thanks for the feedback!

  1. Motivation: I'm working on issue JupyterViz: Add tests #1781 ("Add tests"). I looked into test_solara_viz.py and saw that the UserInputs component had tests for sliders, but not for other supported types. I added the tests for Checkbox and InputText to improve the test coverage for this component, as they are also listed as supported types in the UserInputs function's code.

  2. PR Template: I am very sorry about deleting the template! As a new contributor, I misunderstood the process. I will edit the main PR description right now to follow the template.

Thanks!

@pragam-m25
Copy link
Contributor Author

Hi @Sahil-Chhoker,

Thanks so much for the detailed review! This is really helpful.

  1. You were right, the checkbox test was a duplicate. I've removed it from test_solara_viz.py.
  2. I've moved the InputText test inside the TestMakeUserInput class in test_solara_viz_updated.py and renamed it, as you suggested.
  3. My apologies for the Hinglish comment, that was a mistake from my side while learning and it won't happen again.

I've just pushed the new changes. It looks like the main build checks are failing now, and I'm currently debugging that. I'll let you know when it's all green.
@Sahil-Chhoker

@pragam-m25
Copy link
Contributor Author

Hi @Sahil-Chhoker, just to update: I've found and fixed the bug (it was a test placement error, as you pointed out). All checks are passing now. Ready for review when you have time!

Copy link
Collaborator

@Sahil-Chhoker Sahil-Chhoker left a comment

Choose a reason for hiding this comment

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

Good work, @pragam-m25! Just remove the comments, the code is self-explanatory. After that, this PR is good to go.
Also can you update the title and description of this PR as we are just adding tests for InputText.

@pragam-m25 pragam-m25 force-pushed the issue-1781-solara-tests branch from 61ec1d2 to 5daddfe Compare November 2, 2025 10:35
@pragam-m25 pragam-m25 changed the title Tests: Add tests for Checkbox and InputText in UserInputs Tests: Add test for InputText in UserInputs Nov 2, 2025
@pragam-m25
Copy link
Contributor Author

Hi @Sahil-Chhoker, thanks! I've:

  1. Updated the PR title and description to only mention InputText.
  2. Removed the inline comments as requested.
  3. Added the docstring back to the test method to satisfy the ruff D102 check.

All checks should be passing now. Ready for merge!

@Sahil-Chhoker Sahil-Chhoker merged commit 26c2151 into projectmesa:main Nov 2, 2025
11 checks passed
@pragam-m25 pragam-m25 deleted the issue-1781-solara-tests branch November 2, 2025 11:14
@EwoutH
Copy link
Member

EwoutH commented Nov 2, 2025

Sahil thanks for reviewing, and @pragam-m25 congratulations on getting your first PR merged!

If you're serious about GSoC, say hi to us in our chat (https://app.element.io/#/room/#project-mesa:matrix.org) and read this part of our contribution guide carefully: https://github.com/projectmesa/mesa/blob/main/CONTRIBUTING.md#im-a-developer-but-not-a-modeller

We're an ABM library, so the first part is getting up to speed with ABM! The best way to do that is to start building models.

@pragam-m25
Copy link
Contributor Author

Hi @EwoutH,

Thank you so much! I'm really excited to get my first PR merged.

That's great advice. I'll join the chat right away and start reading the contributing guide you linked. I'm looking forward to learning more about ABM and building some models.

Thanks again for all the guidance!

EwoutH pushed a commit that referenced this pull request Nov 7, 2025
* Tests: Add tests for Checkbox and InputText in UserInputs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix: Remove typo in comment for codespell

* Refactor: Move InputText test to test_solara_viz_updated.py as per review

* Fix: Correctly place test method inside TestMakeUserInput class

---------

Co-authored-by: pragam-m25 <pragam279@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants