Skip to content

Commit

Permalink
Created a new file for the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bowler1 committed Mar 29, 2021
1 parent cd86af2 commit 3e7acd9
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions test/test_earnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

from unittest import mock
from pathlib import Path

from http.client import InvalidURL
from urllib.error import HTTPError
from mock import get_mocked_get_json

# Mock based on https://stackoverflow.com/a/28507806/3558475:
Expand Down Expand Up @@ -42,31 +39,5 @@ def test_mock(self,mock_get_json):
self.assertEqual(len(mock_get_json.call_args_list), 2)


def test_invalid_ticker(self):
invalid = yf.Ticker('InvalidTickerName')
with self.assertRaises(ValueError):
invalid.earnings

invalid = yf.Ticker('') #test empty
with self.assertRaises(HTTPError):
invalid.earnings

invalid = yf.Ticker('LEHLQ') #test debunct
with self.assertRaises(KeyError):
invalid.earnings

invalid = yf.Ticker('GOOE') #test misspelled (like GOOE when we want GOOG)
with self.assertRaises(KeyError):
invalid.earnings

invalid = yf.Ticker(' ') # test white space
with self.assertRaises(InvalidURL):
invalid.earnings

invalid = yf.Ticker('123') # test with numbers
with self.assertRaises(KeyError):
invalid.earnings


if __name__ == '__main__':
unittest.main()

0 comments on commit 3e7acd9

Please sign in to comment.