@@ -150,7 +150,7 @@ def _yahoo_url_from_expiry(self, expiry):
150
150
try :
151
151
expiry_links = self ._expiry_links
152
152
153
- except AttributeError :
153
+ except AttributeError : # pragma: no cover
154
154
_ , expiry_links = self ._get_expiry_dates_and_links ()
155
155
156
156
return self ._FINANCE_BASE_URL + expiry_links [expiry ]
@@ -478,7 +478,7 @@ def _validate_expiry(self, expiry):
478
478
return index [index .date >= expiry ][0 ].date ()
479
479
480
480
def get_forward_data (self , months , call = True , put = False , near = False ,
481
- above_below = 2 ):
481
+ above_below = 2 ): # pragma: no cover
482
482
"""
483
483
***Experimental***
484
484
Gets either call, put, or both data for months starting in the current
@@ -624,14 +624,14 @@ def _get_expiry_dates_and_links(self):
624
624
625
625
try :
626
626
links = root .xpath ('//*[@id="options_menu"]/form/select/option' )
627
- except IndexError :
627
+ except IndexError : # pragma: no cover
628
628
raise RemoteDataError ('Expiry dates not available' )
629
629
630
630
expiry_dates = [dt .datetime .strptime (element .text , "%B %d, %Y" ).date () for element in links ]
631
631
links = [element .attrib ['data-selectbox-link' ] for element in links ]
632
632
633
633
if len (expiry_dates ) == 0 :
634
- raise RemoteDataError ('Data not available' )
634
+ raise RemoteDataError ('Data not available' ) # pragma: no cover
635
635
636
636
expiry_links = dict (zip (expiry_dates , links ))
637
637
self ._expiry_links = expiry_links
@@ -645,17 +645,17 @@ def _parse_url(self, url):
645
645
"""
646
646
try :
647
647
from lxml .html import parse
648
- except ImportError :
648
+ except ImportError : # pragma: no cover
649
649
raise ImportError ("Please install lxml if you want to use the "
650
650
"{0!r} class" .format (self .__class__ .__name__ ))
651
651
try :
652
652
doc = parse (url )
653
- except _network_error_classes :
653
+ except _network_error_classes : # pragma: no cover
654
654
raise RemoteDataError ("Unable to parse URL "
655
655
"{0!r}" .format (url ))
656
656
else :
657
657
root = doc .getroot ()
658
- if root is None :
658
+ if root is None : # pragma: no cover
659
659
raise RemoteDataError ("Parsed URL {0!r} has no root"
660
660
"element" .format (url ))
661
661
return root
@@ -678,7 +678,7 @@ def _process_data(self, frame, type):
678
678
try :
679
679
frame ['Underlying_Price' ] = self .underlying_price
680
680
frame ["Quote_Time" ] = self .quote_time
681
- except AttributeError :
681
+ except AttributeError : # pragma: no cover
682
682
frame ['Underlying_Price' ] = np .nan
683
683
frame ["Quote_Time" ] = np .nan
684
684
frame .rename (columns = {'Open Int' : 'Open_Int' }, inplace = True )
0 commit comments