Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
def test_download_data_from_sec_all_files():
    download_data_from_sec(construct_url(2009, 1))
    assert True
Esempio n. 4
0
def test_construct_url_returns_proper_string():
    expected = 'http://www.sec.gov/data/financial-statements/2015q2.zip'
    assert construct_url(2015, 2) == expected
Esempio n. 5
0
def test_construct_url_raises_with_incorrect_quarter_type():
    with ShouldRaise(TypeError("quarter<class 'str'> not int.")):
        construct_url(2015, '3')
Esempio n. 6
0
def test_construct_url_raises_with_incorrect_year_type():
    with ShouldRaise(TypeError("year<class 'str'> not int.")):
        construct_url('2015', 3)
Esempio n. 7
0
def test_construct_url_raises_with_less_than_range():
    with ShouldRaise(ValueError('quarter: 0 not in range 1-4.')):
        construct_url(2015, 0)