コード例 #1
0
	def test_share_year(self):
        shareAnalyzer = CompanyShareAnalyzer("shareData.csv")
        self.result=shareAnalyzer.getResultSharePriceAnalysis()
        '''   Company 7 max price year is 1990  '''
        self.assertEquals(1990, self.result[6].year)
        '''Just to print the results in one sample '''
        print '\nHere are the results for the final test case \n'
        shareAnalyzer.printResults()
コード例 #2
0
 def test_for_inexistant_file(self):
     shareAnalyzer = CompanyShareAnalyzer("some_non_existant_file.csv")
     self.assertRaises(IOError, lambda: shareAnalyzer.getResultSharePriceAnalysis())
コード例 #3
0
 def test_for_inconsistant_data_in_file(self): 
     shareAnalyzer = CompanyShareAnalyzer("shareData_inconsistant.csv")
     self.assertRaises(DataInconsistantException,  lambda: shareAnalyzer.getResultSharePriceAnalysis())
コード例 #4
0
 def test_share_year(self):
     shareAnalyzer = CompanyShareAnalyzer("shareData.csv")
     self.result=shareAnalyzer.getResultSharePriceAnalysis()
     self.assertEquals(1990, self.result[6].year)
     print '\nHere are the results for the final test case \n'
     shareAnalyzer.printResults()
コード例 #5
0
 def test_share_month(self):
     shareAnalyzer = CompanyShareAnalyzer("shareData.csv")
     self.result=shareAnalyzer.getResultSharePriceAnalysis()
     self.assertEquals('jul', self.result[0].month)
コード例 #6
0
 def test_share_value(self):
     shareAnalyzer = CompanyShareAnalyzer("shareData.csv")
     self.result=shareAnalyzer.getResultSharePriceAnalysis()
     self.assertEquals(100, self.result[8].value)
コード例 #7
0
    def test_for_inconsistant_data_in_file(self): 
        ''' This raises an exception for inconsistent data in file '''
		
        shareAnalyzer = CompanyShareAnalyzer("shareData_inconsistant.csv")
        #print "HELLO %r"% (shareAnalyzer.getResultSharePriceAnalysis().getName())
        self.assertRaises(DataInconsistantException,  lambda: shareAnalyzer.getResultSharePriceAnalysis())
コード例 #8
0
    def test_share_value(self):
        shareAnalyzer = CompanyShareAnalyzer("shareData.csv")
        self.result=shareAnalyzer.getResultSharePriceAnalysis()
        '''   Company 9 maximum price is 100    '''
		self.assertEquals(100, self.result[8].value)
コード例 #9
0
    def test_for_inexistant_file(self):
        ''' This raises an exception for non-existing file '''
		
        shareAnalyzer = CompanyShareAnalyzer("some_non_existant_file.csv")
        self.assertRaises(IOError, lambda: shareAnalyzer.getResultSharePriceAnalysis())