Skip to content

Commit 2484f21

Browse files
__format__ must fall back to __str__ when spec=''
1 parent a4e9267 commit 2484f21

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tunits/core/cython/with_unit.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ cdef class WithUnit:
729729
self.base_units.__setstate__(pickle_info['base_units'])
730730

731731
def __format__(self, spec: str) -> str:
732-
if spec == '' and self.value == 1: return str(self)
732+
if spec == '': return str(self)
733733
return self.value.__format__(spec) + ' ' + str(self.unit)
734734

735735
_try_interpret_as_with_unit = None

0 commit comments

Comments
 (0)