File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,21 @@ def test_repr_truncation(self):
82
82
fmt .print_config .max_colwidth = max_len + 2
83
83
self .assert_ ('...' not in repr (df ))
84
84
85
+ def test_repr_should_return_str (self ):
86
+ """
87
+ http://docs.python.org/py3k/reference/datamodel.html#object.__repr__
88
+ http://docs.python.org/reference/datamodel.html#object.__repr__
89
+ "...The return value must be a string object."
90
+
91
+ (str on py2.x, str (unicode) on py3)
92
+
93
+ """
94
+ data = [8 ,5 ,3 ,5 ]
95
+ index1 = [u"\u03c3 " ,u"\u03c4 " ,u"\u03c5 " ,u"\u03c6 " ]
96
+ cols = [u"\u03c8 " ]
97
+ df = DataFrame (data ,columns = cols ,index = index1 )
98
+ self .assertTrue (type (df .__repr__ () == str )) # both py2 / 3
99
+
85
100
def test_to_string_repr_unicode (self ):
86
101
buf = StringIO ()
87
102
Original file line number Diff line number Diff line change @@ -1057,6 +1057,20 @@ def test_repr_name_iterable_indexable(self):
1057
1057
s .name = (u"\u05d0 " ,) * 2
1058
1058
repr (s )
1059
1059
1060
+ def test_repr_should_return_str (self ):
1061
+ """
1062
+ http://docs.python.org/py3k/reference/datamodel.html#object.__repr__
1063
+ http://docs.python.org/reference/datamodel.html#object.__repr__
1064
+ "...The return value must be a string object."
1065
+
1066
+ (str on py2.x, str (unicode) on py3)
1067
+
1068
+ """
1069
+ data = [8 ,5 ,3 ,5 ]
1070
+ index1 = [u"\u03c3 " ,u"\u03c4 " ,u"\u03c5 " ,u"\u03c6 " ]
1071
+ df = Series (data ,index = index1 )
1072
+ self .assertTrue (type (df .__repr__ () == str )) # both py2 / 3
1073
+
1060
1074
def test_timeseries_repr_object_dtype (self ):
1061
1075
index = Index ([datetime (2000 , 1 , 1 ) + timedelta (i )
1062
1076
for i in range (1000 )], dtype = object )
You can’t perform that action at this time.
0 commit comments