# Define test cases and expected results
= [
test_cases "3/AAPL/10-Q", RequestedFilings(limit=3, ticker_or_cik="AAPL", form_type="10-Q")),
("MSFT/10-K", RequestedFilings(ticker_or_cik="MSFT", form_type="10-K")),
("1/GOOG", RequestedFilings(limit=1, ticker_or_cik="GOOG")),
("BRK.A", RequestedFilings(ticker_or_cik="BRK.A")),
("1/0001990966/SC TO-T", RequestedFilings(limit=1, ticker_or_cik="0001990966", form_type="SC TO-T")),
("1/0001990966/SC TO-T/A", RequestedFilings(limit=1, ticker_or_cik="0001990966", form_type="SC TO-T/A")),
(
]
# Run test cases and assert expected results
for test_string, expected in test_cases:
= RequestedFilings.from_string(test_string)
result assert (
== expected
result f"Test case failed for input: {test_string}. Expected: {expected}, Got: {result}" ),
Ticker
Ticker (symbol:str, exchange:str)
FilingMetadata
FilingMetadata (accession_number:str, form_type:str, primary_doc_url:str, items:str, primary_doc_description:str, filing_date:str, report_date:str, cik:str, company_name:str, tickers:list[__main__.Ticker])
RequestedFilings
RequestedFilings (ticker_or_cik:str, form_type:str='10-Q', limit:int=1)
CompanyAndAccessionNumber
CompanyAndAccessionNumber (ticker_or_cik:str, accession_number:str)
= [
test_cases
("AAPL/0000320193-20-000052",
CompanyAndAccessionNumber(="AAPL", accession_number="0000320193-20-000052"
ticker_or_cik
),
),
("0001193125/000119312520036918",
CompanyAndAccessionNumber(="0001193125", accession_number="000119312520036918"
ticker_or_cik
),
),
("1193125/000119312520036918",
CompanyAndAccessionNumber(="1193125", accession_number="000119312520036918"
ticker_or_cik
),
),"INVALID_STRING", None),
(
]
for test_input, expected in test_cases:
= CompanyAndAccessionNumber.from_string(test_input, must_match=False)
result assert (
== expected
result f"Test case failed for input: {test_input}. Expected: {expected}, Got: {result}" ),