def test_sec_file_generator(): data = sec_file_generator(download_data_from_sec(construct_url(2009, 1)), 'sub.txt') for row in data: print(row)
def test_download_data_from_sec_all_files(): download_data_from_sec(construct_url(2009, 1)) assert True
def test_sec_file_generator_raises(): with ShouldRaise(KeyError("Invalid file name blah.txt, not in ['pre.txt', 'sub.txt', 'readme.htm', 'num.txt', 'tag.txt']")): data = sec_file_generator(download_data_from_sec(construct_url(2009, 1)), 'blah.txt') for row in data: print(row)
def test_download_data_from_sec_url_validates_files(): with ShouldRaise(ValueError('url does not contain a valid url: bam')): download_data_from_sec('bam')