import unittest
import pandas as pd
from alcoholTimeAnalizerTestVersion import alcoholTimeAnalizer
from file_loader import fileloader
from file_loader import badfileLoader

alteredfile = badfileLoader()

emptydf = pd.DataFrame({'' : []})

emptyName = None

wrongData = [1,2,3,4,5,6]

emptyData = None

incorrectName = 'BADNESS'

# Valid Names: DAY_OF_WEEK, LIGHT_CONDITION, ALCOHOL_RELATED, SEVERITY
correctName1 = 'DAY_OF_WEEK'

correctName2 = 'LIGHT_CONDITION'

correctName3 = 'ALCOHOL_RELATED'

correctName4 = 'SEVERITY'

#Valid Data: data
data = fileloader()


class testAlcoholTimeAnalizer(unittest.TestCase):
    
    def testCorrectDataCorrectName1(self):
        result = alcoholTimeAnalizer(data, correctName1)
        self.assertEqual(result, 'Success')
        
    def testCorrectDataCorrectName2(self):
        result = alcoholTimeAnalizer(data, correctName2)
        self.assertEqual(result, 'Success')
        
    def testCorrectDataCorrectName3(self):
        result = alcoholTimeAnalizer(data, correctName3)
        self.assertEqual(result, 'Success')
        
    def testCorrectDataCorrectName4(self):
        result = alcoholTimeAnalizer(data, correctName4)
        self.assertEqual(result, 'Success')
        
    def testCorrectDataIncorrectName(self):
        result = alcoholTimeAnalizer(data, incorrectName)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testCorrectDataNoName(self):
        result = alcoholTimeAnalizer(data, emptyName)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testCorrectDataIntName(self):
        result = alcoholTimeAnalizer(data, 2)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testIncorrectDataCorrectName1(self):
        result = alcoholTimeAnalizer(wrongData, correctName1)
        self.assertEqual(result, 'Incorrect Data Type')
        
    def testEmptyDataName1(self):
        result = alcoholTimeAnalizer(emptyData, correctName1)
        self.assertEqual(result, 'Incorrect Data Type')
        
    def testAlteredDataCorrectName1(self):
        result = alcoholTimeAnalizer(alteredfile, correctName1)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testAlteredDataIncorrectName(self):
        result = alcoholTimeAnalizer(alteredfile, incorrectName)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testEmptyDataIncorrectName(self):
        result = alcoholTimeAnalizer(emptydf, incorrectName)
        self.assertEqual(result, 'Incorrect Data or Name')
        
    def testEmptyDataEmptyName(self):
        result = alcoholTimeAnalizer(emptydf, emptyName)
        self.assertEqual(result, 'Incorrect Data or Name')



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