Skip to content

BHoM_Engine: TryRunExtensionMethod made more sensitive to inputs #3425

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

Merged

Conversation

pawelbaran
Copy link
Member

@pawelbaran pawelbaran commented Nov 1, 2024

Issues addressed by this PR

Closes #3424

Test files

See the changes in the test project - review and run the newly added tests.

Changelog

Additional comments

@pawelbaran pawelbaran added the type:feature New capability or enhancement label Nov 1, 2024
@pawelbaran pawelbaran requested a review from alelom November 1, 2024 16:37
@pawelbaran pawelbaran self-assigned this Nov 1, 2024
@alelom
Copy link
Member

alelom commented Nov 4, 2024

Not sure how to best test it

With unit tests! 😄 That's why I always push for them. I'd put that code you wrote in BHoM_Engine\.ci\unit-tests\BHoM_Engine_Tests.sln. There you can create a "fake" engine project where you can put "fake" extension methods to test stuff like this. Then you can create a unit test to call them in the Base_Engine_Tests project.

I think it's important, especially for foundational stuff like this, that we start building a proper library of tests. But take it as a proposal, I won't enforce in my review. It is hard to test without that though.
For example, I would add another edge case to the list. What happens if we have a public engine method with no argument? Probably nothing, but how do we make sure? Also, is there an edge case where types[0] would throw an index error in this line? Again, probably not, but without running a suite of tests it's always a bit of a risk to know that everything works safely when we touch this kind of foundational code.

@pawelbaran pawelbaran requested a review from rwemay as a code owner November 4, 2024 15:29
@pawelbaran
Copy link
Member Author

Good shout @alelom! I did not know we have a NUnit test solution ready for use. Ported the code over and updated the PR description. Ready for review!

alelom
alelom previously approved these changes Nov 5, 2024
Copy link
Member

@alelom alelom left a comment

Choose a reason for hiding this comment

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

Reviewed and tested with @pawelbaran using the provided Unit Tests. Only change I'd recommend is to make more descriptive names to test where applicable.

@pawelbaran
Copy link
Member Author

@BHoMBot check compliance

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check branch-compliance
  • check dataset-compliance
  • check copyright-compliance

There are 15 requests in the queue ahead of you.

@pawelbaran
Copy link
Member Author

@BHoMBot check compliance

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check branch-compliance
  • check dataset-compliance
  • check copyright-compliance

@pawelbaran
Copy link
Member Author

@BHoMBot check versioning

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check versioning

There are 19 requests in the queue ahead of you.

Copy link

bhombot-ci bot commented Nov 5, 2024

FAO: @adecler @pawelbaran @IsakNaslundBh
@pawelbaran is seeking dispensation on this Pull Request to skip a required check. Please can you provide authorisation for the check to be skipped, or provide assistance as appropriate.

The check they wish to have dispensation on is documentation-compliance.

If you are providing dispensation on this occasion, please reply with:

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 32529549559

@pawelbaran
Copy link
Member Author

@BHoMBot check core
@BHoMBot check null-handling
@BHoMBot check serialisation
@BHoMBot check unit-tests

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check core
  • check null-handling
  • check serialisation
  • check unit-tests

@pawelbaran
Copy link
Member Author

@BHoMBot check unit-tests

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check unit-tests

@pawelbaran
Copy link
Member Author

@BHoMBot check unit-tests
@BHoMBot check compliance
@BHoMBot check core
@BHoMBot check serialisation
@BHoMBot check null-handling

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check unit-tests
  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check branch-compliance
  • check dataset-compliance
  • check copyright-compliance
  • check core
  • check serialisation
  • check null-handling

@pawelbaran
Copy link
Member Author

@BHoMBot check versioning

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check versioning

Copy link

bhombot-ci bot commented Nov 5, 2024

FAO: @adecler @pawelbaran @IsakNaslundBh
@pawelbaran is seeking dispensation on this Pull Request to skip a required check. Please can you provide authorisation for the check to be skipped, or provide assistance as appropriate.

The check they wish to have dispensation on is documentation-compliance.

If you are providing dispensation on this occasion, please reply with:

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 32533482456

Copy link
Member

@alelom alelom left a comment

Choose a reason for hiding this comment

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

Re-approving following previous review. Thank you! 😄

@pawelbaran
Copy link
Member Author

@BHoMBot check installer

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check installer

@pawelbaran
Copy link
Member Author

Dispensating documentation compliance because all failures concern UTs sitting under .ci.

@pawelbaran
Copy link
Member Author

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 32533482456

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran I have now provided a passing check on reference 32533482456 as requested.

@pawelbaran
Copy link
Member Author

@BHoMBot check ready-to-merge

Copy link

bhombot-ci bot commented Nov 5, 2024

@pawelbaran to confirm, the following actions are now queued:

  • check ready-to-merge

There are 31 requests in the queue ahead of you.

@pawelbaran pawelbaran merged commit a6f9074 into develop Nov 5, 2024
13 checks passed
@pawelbaran pawelbaran deleted the BHoM_Engine-#3424-TryRunExtensionMethodMoreSensitive branch November 5, 2024 14:18
@BHoMBot BHoMBot mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New capability or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BHoM_Engine: make TryRunExtensionMethod look into all method arguments when binding
2 participants