Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Add more specific integer constructors #76

Merged
merged 3 commits into from
Apr 30, 2020

Conversation

rajatdiptabiswas
Copy link
Contributor

Fixes #72

  • Removed SupportsFloat from the classes int8, int16, int32, int64, uint8, uint16, uint32, and uint64
  • Removed a test from tests/pass/scalars.py
  • Added several tests to tests/fail/scalars.py

Kindly let me know if these look alright.

Fixes numpy#72

- Removed SupportsFloat from the classes int8, int16, int32, int64, uint8, uint16, uint32, and uint64
- Removed a test from tests/pass/scalars.py
- Added several tests to tests/fail/scalars.py
Updated tests/fail/scalars.py with formatting done by black
Copy link
Member

@person142 person142 left a comment

Choose a reason for hiding this comment

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

Looks good @rajatdiptabiswas! Just had one small comment.

@@ -20,7 +20,6 @@ def __float__(self):
np.int16(3.4)
np.int32(4)
np.int64(-1)
np.uint8(A())
Copy link
Member

Choose a reason for hiding this comment

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

Instead of removing, I would follow what is done here:

https://github.com/numpy/numpy-stubs/pull/70/files#diff-dd377d4c09025262e6f7008bcfe583dfR10

i.e.

class B:
    def __int__(self):
        return 4

...

np.uint8(B())

(That way we keep a case checking that a class with __int__ passes.)

- Added an uint8 test back
- Created a new integer class definition
- Corrected a float class definition
@rajatdiptabiswas
Copy link
Contributor Author

Made the changes you mentioned @person142.
Take a look at it and let me know if everything looks fine now.

Thanks.

@person142 person142 merged commit bfad574 into numpy:master Apr 30, 2020
@person142
Copy link
Member

Merged, thanks @rajatdiptabiswas.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsigned int constructors too generous
2 participants