示例#1
0
 def test_download_fail_empty(self):
     kr = gm.KeyRatiosDownloader()
     tickersym = ''
     exp = "You did not enter a ticker symbol.  Please try again."
     with self.assertRaises(Exception) as context:
         checked = kr.download(tickersym)
     the_exception = context.exception
     return self.assertEqual(
         exp, str(the_exception), "Passing an empty string to "
         "good_morning fails")
示例#2
0
 def test_download_fail_invalid(self):
     kr = gm.KeyRatiosDownloader()
     tickersym = 'nothing'
     exp = "MorningStar cannot find the ticker symbol you entered " \
           "or it is INVALID. Please try again."
     with self.assertRaises(Exception) as context:
         checked = kr.download(tickersym)
     the_exception = context.exception
     return self.assertEqual(
         exp, str(the_exception), "Passing an invalid ticker symbol to"
         " good_morning fails")
示例#3
0
 def test_downloadreturn(self):
     kr = gm.KeyRatiosDownloader()
     frames = kr.download('aapl')
     test = len(frames)
     exp = 11
     self.assertEqual(test, exp, "Download is working")
示例#4
0
DB_NAME = 'ms_financials_db'

#'MySQL_MSDB'

#'ms_financial_db'

#'ms_financial_db'
#Service = 'MySQL_MSDB'

conn = pymysql.connect(host=DB_HOST,
                       port=DB_PORT,
                       user=DB_USER,
                       passwd=DB_PASS,
                       db=DB_NAME)

kr = gm.KeyRatiosDownloader()
fd = gm.FinancialsDownloader()


#class TestDownloadReturns(TestCase):
#class TestDownloadReturns():
def vaid_shenzhen_ticker_yielder():
    for i in range(1000001, 1011980):
        yield str(i)[1:]


def vaid_techboard_ticker_yielder():
    for i in range(1300001, 1301000):
        yield str(i)[1:]