mirror of
https://github.com/python/cpython.git
synced 2026-01-27 09:42:08 +00:00
Remove trailing 'L's from numerator and denominator in the
repr() of a Fraction instance.
This commit is contained in:
parent
6e7e137cff
commit
3af386a5cb
2 changed files with 5 additions and 1 deletions
|
|
@ -203,7 +203,7 @@ def denominator(a):
|
|||
|
||||
def __repr__(self):
|
||||
"""repr(self)"""
|
||||
return ('Fraction(%r, %r)' % (self._numerator, self._denominator))
|
||||
return ('Fraction(%s, %s)' % (self._numerator, self._denominator))
|
||||
|
||||
def __str__(self):
|
||||
"""str(self)"""
|
||||
|
|
|
|||
|
|
@ -351,6 +351,10 @@ def testMixedEqual(self):
|
|||
|
||||
def testStringification(self):
|
||||
self.assertEquals("Fraction(7, 3)", repr(F(7, 3)))
|
||||
self.assertEquals("Fraction(6283185307, 2000000000)",
|
||||
repr(F('3.1415926535')))
|
||||
self.assertEquals("Fraction(-1, 100000000000000000000)",
|
||||
repr(F(1, -10**20)))
|
||||
self.assertEquals("7/3", str(F(7, 3)))
|
||||
self.assertEquals("7", str(F(7, 1)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue