Skip to content
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

Add constructor input checks for matchers #233

Open
fornellas opened this issue Sep 1, 2020 · 0 comments
Open

Add constructor input checks for matchers #233

fornellas opened this issue Sep 1, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request Hacktoberfest

Comments

@fornellas
Copy link
Contributor

When we do:

AnyInstanceOf(not_a_type)

we end up raising an exception not at the constructor, but rather when the comparison is being made, and isinstanceof (at AnyInstanceOf's code) will complain that not_a_type is... not a type.

Let's revisit all matchers & ensure that all of them raise ValueError if the constructor arguments are invalid from the constructor itself.

CC @deathowl

@fornellas fornellas added the enhancement New feature or request label Sep 1, 2020
@deathowl deathowl self-assigned this Sep 2, 2020
facebook-github-bot pushed a commit that referenced this issue Mar 23, 2021
Summary:
<!--
Thank you for your interest in this project. Bugs filed and PRs submitted are appreciated!

Please make sure that you are familiar with and follow the Code of Conduct of this project which can be found at https://github.com/facebookincubator/TestSlide/blob/master/CODE_OF_CONDUCT.md

Also, please make sure you're familiar with and follow the instructions in the contributing guidelines which can  be found at https://github.com/facebookincubator/TestSlide/blob/master/CONTRIBUTING.md

-->

**What:**

#233

**Why:**

**How:**

Checked for the input arguments of the `AnyInstanceOf` to be of an instance of `type`. If not, raise a `ValueError` exception.

**Risks:**

**Checklist**:

<!--
Have you done all of these things?
To check an item, place an "x" in the box like so: "- [x] Tests"
Add "N/A" to the end of each line that's irrelevant to your changes
-->

- [x] Added tests, if you've added code that should be tested
- [x] Updated the documentation, if you've changed APIs
- [x] Ensured the test suite passes
- [x] Made sure your code lints
- [x] Completed the Contributor License Agreement ("CLA")

Do I need to add the "correct usage" of the AnyInstanceOf in the tests?

Pull Request resolved: #291

Reviewed By: deathowl

Differential Revision: D27237895

Pulled By: macisamuele

fbshipit-source-id: a13a14d0cd04e747a143f2c6722b285e0cf17625
facebook-github-bot pushed a commit that referenced this issue May 26, 2021
Summary:
<!--
Thank you for your interest in this project. Bugs filed and PRs submitted are appreciated!

Please make sure that you are familiar with and follow the Code of Conduct of this project which can be found at https://github.com/facebookincubator/TestSlide/blob/master/CODE_OF_CONDUCT.md

Also, please make sure you're familiar with and follow the instructions in the contributing guidelines which can  be found at https://github.com/facebookincubator/TestSlide/blob/master/CONTRIBUTING.md

-->

**What:**

Fix for issue #233
1. Added Constructor level input type checks for various Matchers.

**Why:**

**How:**

_For point 1_
Checked for the passed arguments to be of the specified types. If not, raised a `ValueError` with appropriate error message.

**Risks:**

N/A. At least not intentionally.

**Checklist**:

<!--
Have you done all of these things?
To check an item, place an "x" in the box like so: "- [x] Tests"
Add "N/A" to the end of each line that's irrelevant to your changes
-->

- [x] Added tests, if you've added code that should be tested
- [x] Updated the documentation, if you've changed APIs
- [x] Ensured the test suite passes
- [x] Made sure your code lints
- [x] Completed the Contributor License Agreement ("CLA")

Pull Request resolved: #303

Reviewed By: doranand

Differential Revision: D28693338

Pulled By: deathowl

fbshipit-source-id: 91cbba5951e5e7a7ed65515756587be2bbf78f54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest
Projects
None yet
Development

No branches or pull requests

2 participants