Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove float in intern test
  • Loading branch information
aisk committed Sep 19, 2023
commit 1653d056d9a51dd9b26b62f066a9270beb00cd1f
4 changes: 2 additions & 2 deletions Lib/test/test_sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def test_43581(self):

def test_intern(self):
self.assertRaises(TypeError, sys.intern)
s = "never interned before" + str(random.random())
s = "never interned before" + str(random.int(10**8, 10**9))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

random.int doesn't exist. What's the point of putting a minimum at 10**8? Why not 0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is a more recent commit in the PR fixed the bug. The minimal start is for ensure the random parts have 9 digits, I think it's more consistent.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i don't think that the string length (number of random int digits) matters here, does it?

self.assertTrue(sys.intern(s) is s)
s2 = s.swapcase().swapcase()
self.assertTrue(sys.intern(s2) is s)
Expand All @@ -711,7 +711,7 @@ def __hash__(self):

@requires_subinterpreters
def test_subinterp_intern_dynamically_allocated(self):
s = "never interned before" + str(random.random())
s = "never interned before" + str(random.int(10**8, 10**9))
t = sys.intern(s)
self.assertIs(t, s)

Expand Down