Skip to content

Commit ce1eb27

Browse files
committed
Changes instances representation
1 parent a3a4d46 commit ce1eb27

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

pendulum/interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def __str__(self):
229229
return self.in_words()
230230

231231
def __repr__(self):
232-
return self.in_words()
232+
return '<{0} [{1}]>'.format(self.__class__.__name__, str(self))
233233

234234
def __add__(self, other):
235235
if isinstance(other, timedelta):

pendulum/pendulum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ def __str__(self):
936936
return self.format(self._to_string_format)
937937

938938
def __repr__(self):
939-
return str(self)
939+
return '<{0} [{1}]>'.format(self.__class__.__name__, str(self))
940940

941941
def to_date_string(self):
942942
"""

tests/interval_tests/test_in_words.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ def test_in_french(self):
4040
def test_repr(self):
4141
pi = Interval(days=1177, seconds=7284, microseconds=1000000)
4242
self.assertEqual(
43-
'168 weeks 1 day 2 hours 1 minute 25 seconds',
43+
'<Interval [168 weeks 1 day 2 hours 1 minute 25 seconds]>',
4444
repr(pi)
4545
)

tests/pendulum_tests/test_strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ def test_custom_formatters(self):
105105

106106
def test_repr(self):
107107
d = Pendulum(1975, 12, 25, 14, 15, 16, tzinfo='local')
108-
self.assertEqual('1975-12-25T14:15:16-05:00', repr(d))
108+
self.assertEqual('<Pendulum [1975-12-25T14:15:16-05:00]>', repr(d))

0 commit comments

Comments
 (0)