@@ -552,8 +552,10 @@ def _clean_options(self, options, engine):
552
552
553
553
# type conversion-related
554
554
if converters is not None :
555
- if not (isinstance (converters , dict )):
556
- raise AssertionError ()
555
+ if not isinstance (converters , dict ):
556
+ raise TypeError ('Type converters must be a dict or'
557
+ ' subclass, input was '
558
+ 'a {0!r}' .format (type (converters ).__name__ ))
557
559
else :
558
560
converters = {}
559
561
@@ -631,6 +633,7 @@ def get_chunk(self, size=None):
631
633
size = self .chunksize
632
634
return self .read (nrows = size )
633
635
636
+
634
637
def _is_index_col (col ):
635
638
return col is not None and col is not False
636
639
@@ -1174,6 +1177,7 @@ def TextParser(*args, **kwds):
1174
1177
kwds ['engine' ] = 'python'
1175
1178
return TextFileReader (* args , ** kwds )
1176
1179
1180
+
1177
1181
# delimiter=None, dialect=None, names=None, header=0,
1178
1182
# index_col=None,
1179
1183
# na_values=None,
@@ -1653,8 +1657,8 @@ def _rows_to_cols(self, content):
1653
1657
if self ._implicit_index :
1654
1658
col_len += len (self .index_col )
1655
1659
1656
- if not (( self .skip_footer >= 0 )) :
1657
- raise AssertionError ( )
1660
+ if self .skip_footer < 0 :
1661
+ raise ValueError ( 'skip footer cannot be negative' )
1658
1662
1659
1663
if col_len != zip_len and self .index_col is not False :
1660
1664
i = 0
@@ -1883,6 +1887,7 @@ def _clean_na_values(na_values, keep_default_na=True):
1883
1887
1884
1888
return na_values , na_fvalues
1885
1889
1890
+
1886
1891
def _clean_index_names (columns , index_col ):
1887
1892
if not _is_index_col (index_col ):
1888
1893
return None , columns , index_col
@@ -1941,6 +1946,7 @@ def _floatify_na_values(na_values):
1941
1946
pass
1942
1947
return result
1943
1948
1949
+
1944
1950
def _stringify_na_values (na_values ):
1945
1951
""" return a stringified and numeric for these values """
1946
1952
result = []
@@ -1965,6 +1971,7 @@ def _stringify_na_values(na_values):
1965
1971
pass
1966
1972
return set (result )
1967
1973
1974
+
1968
1975
def _get_na_values (col , na_values , na_fvalues ):
1969
1976
if isinstance (na_values , dict ):
1970
1977
if col in na_values :
@@ -2014,15 +2021,17 @@ def __init__(self, f, colspecs, filler, thousands=None, encoding=None):
2014
2021
encoding = get_option ('display.encoding' )
2015
2022
self .encoding = encoding
2016
2023
2017
- if not ( isinstance (colspecs , (tuple , list ))):
2018
- raise AssertionError ()
2024
+ if not isinstance (colspecs , (tuple , list )):
2025
+ raise TypeError ("column specifications must be a list or tuple, "
2026
+ "input was a %r" % type (colspecs ).__name__ )
2019
2027
2020
2028
for colspec in colspecs :
2021
- if not ( isinstance (colspec , (tuple , list )) and
2022
- len (colspec ) == 2 and
2023
- isinstance (colspec [0 ], int ) and
2024
- isinstance (colspec [1 ], int ) ):
2025
- raise AssertionError ()
2029
+ if not (isinstance (colspec , (tuple , list )) and
2030
+ len (colspec ) == 2 and
2031
+ isinstance (colspec [0 ], int ) and
2032
+ isinstance (colspec [1 ], int )):
2033
+ raise TypeError ('Each column specification must be '
2034
+ '2 element tuple or list of integers' )
2026
2035
2027
2036
def next (self ):
2028
2037
line = next (self .f )
0 commit comments