예제 #1
0
 def test_save_with_single_level_cik_dir_pattern(
         self, tmp_data_directory, mock_daily_quarter_directory,
         mock_daily_idx_file, mock_filing_response, cik, file):
     daily_filing = DailyFilings(date(2018, 12, 31))
     daily_filing.save(tmp_data_directory, dir_pattern="{cik}")
     path_to_check = os.path.join(tmp_data_directory, cik, file)
     assert os.path.exists(path_to_check)
예제 #2
0
 def test_save_default(self, tmp_data_directory,
                       mock_daily_quarter_directory, mock_daily_idx_file,
                       mock_filing_response, cik, file):
     daily_filing = DailyFilings(date(2018, 12, 31))
     daily_filing.save(tmp_data_directory)
     subdir = os.path.join("20181231", cik)
     path_to_check = os.path.join(tmp_data_directory, subdir, file)
     assert os.path.exists(path_to_check)
예제 #3
0
 def test_save_with_single_level_date_dir_pattern(
         self, tmp_data_directory, mock_daily_quarter_directory,
         mock_daily_idx_file, mock_filing_response, file):
     daily_filing = DailyFilings(date(2018, 12, 31))
     daily_filing.save(tmp_data_directory,
                       dir_pattern="{date}",
                       date_format="%Y-%m-%d")
     path_to_check = os.path.join(tmp_data_directory, "2018-12-31", file)
     assert os.path.exists(path_to_check)
예제 #4
0
 def test_save_with_multi_level_dir_pattern_date_not_first(
         self, tmp_data_directory, mock_daily_quarter_directory,
         mock_daily_idx_file, mock_filing_response, cik, file):
     daily_filing = DailyFilings(date(2018, 12, 31))
     daily_filing.save(tmp_data_directory,
                       dir_pattern="{cik}/{date}",
                       date_format="%Y-%m-%d")
     subdir = os.path.join(cik, "2018-12-31")
     path_to_check = os.path.join(tmp_data_directory, subdir, file)
     assert os.path.exists(path_to_check)
예제 #5
0
 def test_save(self, tmp_data_directory, monkeypatch, subdir, file):
     daily_filing = DailyFilings(datetime(2018, 12, 31))
     monkeypatch.setattr(DailyFilings, "_get_quarterly_directory",
                         MockQuarterDirectory)
     monkeypatch.setattr(DailyFilings, '_get_master_idx_file',
                         mock_master_idx_file)
     monkeypatch.setattr(requests, 'get', MockFilingData)
     daily_filing.save(tmp_data_directory)
     path_to_check = os.path.join(tmp_data_directory, subdir, file)
     assert os.path.exists(path_to_check)