Esempio n. 1
0
 def test_GPAfailure(self):
     failgpa = GPA("This is not the GPA you're looking for 7.4", '1')
     self.assertIsNotNone(failgpa)
     self.assertEqual(
         True, failgpa.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertNotEqual('7.4', failgpa.getGPA())
     self.assertEqual('', failgpa.getGPA())
Esempio n. 2
0
 def test_updateLogicGroup(self):
     testUpdateLogicGroup = GPA('Undergraduates must have a 3.0 GPA, while graduate students must have a 3.25', '5')
     self.assertIsNotNone(testUpdateLogicGroup)
     testUpdateLogicGroup.getGPA()
     self.assertEqual('1', testUpdateLogicGroup.logicGroup)
     test_SPRFLogicGroup = testUpdateLogicGroup.getScholarshipPackageRequirementFormat()
     self.assertEqual('1', test_SPRFLogicGroup.logicGroup)
Esempio n. 3
0
 def test_GPAvsDollarSign(self):
     testGPANoDollarSign = GPA('$3.50 is money, but 3.49 is a GPA', '1')
     self.assertIsNotNone(testGPANoDollarSign)
     self.assertEqual(
         True,
         testGPANoDollarSign.checkContext(
             'gpa|grade\spoint\saverage|maintain'))
     self.assertNotEqual('3.50', testGPANoDollarSign.getGPA())
     self.assertEqual('3.49', testGPANoDollarSign.getGPA())
Esempio n. 4
0
 def test_updateLogicGroup(self):
     testUpdateLogicGroup = GPA(
         'Undergraduates must have a 3.0 GPA, while graduate students must have a 3.25',
         '5')
     self.assertIsNotNone(testUpdateLogicGroup)
     testUpdateLogicGroup.getGPA()
     self.assertEqual('1', testUpdateLogicGroup.logicGroup)
     test_SPRFLogicGroup = testUpdateLogicGroup.getScholarshipPackageRequirementFormat(
     )
     self.assertEqual('1', test_SPRFLogicGroup.logicGroup)
Esempio n. 5
0
 def test_GPACreateSPRFClass(self):
     testSPRFforGPA = GPA('This is to test the SPRF function for the grade point average of 2.9', '1543')
     self.assertIsNotNone(testSPRFforGPA)
     self.assertEqual(True, testSPRFforGPA.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual('2.9', testSPRFforGPA.getGPA())
     self.assertIsNotNone(testSPRFforGPA.getScholarshipPackageRequirementFormat())
     test_SPRF = testSPRFforGPA.getScholarshipPackageRequirementFormat()
     self.assertEqual('1543', test_SPRF.scholarshipPackageId)
     self.assertEqual('1', test_SPRF.attributeId)
     self.assertEqual('>=', test_SPRF.requirementType)
     self.assertEqual('2.9', test_SPRF.requirementValue)
     self.assertEqual('0', test_SPRF.logicGroup)
Esempio n. 6
0
 def test_GPAWithoutGPAKeywords(self):
     testGPANoKeywords = GPA('Must have a 3.80', '5')
     self.assertIsNotNone(testGPANoKeywords)
     self.assertEqual(False, testGPANoKeywords.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual(False, testGPANoKeywords.checkContext('million|billion|trillion|version|dollar|pound|euro'))
     self.assertEqual('3.80', testGPANoKeywords.getGPA())
     failGPANoKeywords = GPA('Must have 3.80 million dollars', '5')
     self.assertIsNotNone(failGPANoKeywords)
     self.assertEqual(False, failGPANoKeywords.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual(True, failGPANoKeywords.checkContext('million|billion|trillion|version|dollar|pound|euro'))
     self.assertEqual('', failGPANoKeywords.getGPA())
Esempio n. 7
0
    def getGPAFromSentences(self, sentences):
        gpa = []

        for sentence in sentences:
            if len(sentence) <= 1000:
                maybeGPA = GPA(sentence).getGPA()
                if maybeGPA != '':
                    gpa.append(maybeGPA)

        gpa = list(set(gpa))
        gpa = ', '.join(gpa)

        return gpa
Esempio n. 8
0
 def test_GPAWithoutGPAKeywords(self):
     testGPANoKeywords = GPA('Must have a 3.80', '5')
     self.assertIsNotNone(testGPANoKeywords)
     self.assertEqual(
         False,
         testGPANoKeywords.checkContext(
             'gpa|grade\spoint\saverage|maintain'))
     self.assertEqual(
         False,
         testGPANoKeywords.checkContext(
             'million|billion|trillion|version|dollar|pound|euro'))
     self.assertEqual('3.80', testGPANoKeywords.getGPA())
     failGPANoKeywords = GPA('Must have 3.80 million dollars', '5')
     self.assertIsNotNone(failGPANoKeywords)
     self.assertEqual(
         False,
         failGPANoKeywords.checkContext(
             'gpa|grade\spoint\saverage|maintain'))
     self.assertEqual(
         True,
         failGPANoKeywords.checkContext(
             'million|billion|trillion|version|dollar|pound|euro'))
     self.assertEqual('', failGPANoKeywords.getGPA())
Esempio n. 9
0
 def test_GPACreateSPRFClass(self):
     testSPRFforGPA = GPA(
         'This is to test the SPRF function for the grade point average of 2.9',
         '1543')
     self.assertIsNotNone(testSPRFforGPA)
     self.assertEqual(
         True,
         testSPRFforGPA.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual('2.9', testSPRFforGPA.getGPA())
     self.assertIsNotNone(
         testSPRFforGPA.getScholarshipPackageRequirementFormat())
     test_SPRF = testSPRFforGPA.getScholarshipPackageRequirementFormat()
     self.assertEqual('1543', test_SPRF.scholarshipPackageId)
     self.assertEqual('1', test_SPRF.attributeId)
     self.assertEqual('>=', test_SPRF.requirementType)
     self.assertEqual('2.9', test_SPRF.requirementValue)
     self.assertEqual('0', test_SPRF.logicGroup)
Esempio n. 10
0
 def test_GPA(self):
     testgpa = GPA('The GPA is 3.159 not 5.304', '1')
     self.assertIsNotNone(testgpa)
     self.assertEqual(
         True, testgpa.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual('3.159', testgpa.getGPA())
Esempio n. 11
0

def GetInfoFromDatabase():
    cursor.execute(
        "SELECT ScholarshipPackageId, Elgibility FROM dbo.DepartmentTestCases WHERE AttributeId =1 OR AttributeId =364"
    )


ConnectToTheDatabase()
GetInfoFromDatabase()

Eligibilities = []
ScholarshipIds = []
while 1:
    row = cursor.fetchone()
    if not row:
        break
    Eligibilities.append(row.Elgibility)
    ScholarshipIds.append(row.ScholarshipPackageId)

for e in range(len(Eligibilities)):
    Eligibility = Eligibilities[e]
    print(ScholarshipIds[e])

    Eligibility = Eligibilities[e]
    Eligibility = re.sub('<.*?>|&nbsp;', '', Eligibility)

    testGPA = GPA(Eligibility, ScholarshipIds[e])
    print(Eligibility)
    print(testGPA.getGPA())
    print('\n\n')
Esempio n. 12
0
 def doGPAParser(self, eligibility, scholarshipId):
     parseGPA = GPA(eligibility, scholarshipId)
     if parseGPA.getGPA() != '':
         # print(parseGPA.getGPA())
         # print(parseGPA.getScholarshipPackageRequirementFormat().getStringValue())
         return parseGPA.getScholarshipPackageRequirementFormat()
Esempio n. 13
0
 def test_GPAvsDollarSign(self):
     testGPANoDollarSign = GPA('$3.50 is money, but 3.49 is a GPA', '1')
     self.assertIsNotNone(testGPANoDollarSign)
     self.assertEqual(True, testGPANoDollarSign.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertNotEqual('3.50', testGPANoDollarSign.getGPA())
     self.assertEqual('3.49', testGPANoDollarSign.getGPA())
Esempio n. 14
0
 def test_GPAfailure(self):
     failgpa = GPA("This is not the GPA you're looking for 7.4", '1')
     self.assertIsNotNone(failgpa)
     self.assertEqual(True, failgpa.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertNotEqual('7.4', failgpa.getGPA())
     self.assertEqual('', failgpa.getGPA())
Esempio n. 15
0
 def test_verifyMaintains(self):
     testOfMaintain = GPA('Must maintain a $3.0 gpa', '5')
     self.assertIsNotNone(testOfMaintain)
     self.assertEqual("", testOfMaintain.getGPA())
     testOfMaintain = GPA('Must maintain a 3.5', '5')
     self.assertIsNotNone(testOfMaintain)
Esempio n. 16
0
 def test_verifyMaintains(self):
     testOfMaintain = GPA('Must maintain a 3.0 gpa', '5')
     self.assertIsNotNone(testOfMaintain)
     testOfMaintain = GPA('Must maintain a 3.5', '5')
     self.assertIsNotNone(testOfMaintain)
Esempio n. 17
0
    global cnxn, cursor
    cnxn = pyodbc.connect(r'Driver={SQL Server};Server=SUDB-DEV;Database=Spiderman;Trusted_Connection=yes;')
    cursor = cnxn.cursor()


def GetInfoFromDatabase():
    cursor.execute("SELECT ScholarshipPackageId, Elgibility FROM dbo.DepartmentTestCases WHERE AttributeId =1 OR AttributeId =364")

ConnectToTheDatabase()
GetInfoFromDatabase()

Eligibilities = []
ScholarshipIds = []
while 1:
    row = cursor.fetchone()
    if not row:
        break
    Eligibilities.append(row.Elgibility)
    ScholarshipIds.append(row.ScholarshipPackageId)

for e in range(len(Eligibilities)):
    Eligibility = Eligibilities[e]
    print(ScholarshipIds[e])

    Eligibility = Eligibilities[e]
    Eligibility = re.sub('<.*?>|&nbsp;', '', Eligibility)

    testGPA = GPA(Eligibility, ScholarshipIds[e])
    print(Eligibility)
    print(testGPA.getGPA())
    print('\n\n')
Esempio n. 18
0
 def test_GPA(self):
     testgpa = GPA('The GPA is 3.159 not 5.304', '1')
     self.assertIsNotNone(testgpa)
     self.assertEqual(True, testgpa.checkContext('gpa|grade\spoint\saverage|maintain'))
     self.assertEqual('3.159', testgpa.getGPA())
Esempio n. 19
0
    cursor = cnxn.cursor()


def GetInfoFromDatabase():
    cursor.execute("SELECT ScholarshipPackageId, Elgibility FROM dbo.DepartmentTestCases")

ConnectToTheDatabase()
GetInfoFromDatabase()

Eligibilities = []
ScholarshipIds = []
while 1:
    row = cursor.fetchone()
    if not row:
        break
    Eligibilities.append(row.Elgibility)
    ScholarshipIds.append(row.ScholarshipPackageId)

for e in range(len(Eligibilities)):
    print(ScholarshipIds[e])

    Eligibility = Eligibilities[e]
    Eligibility = re.sub('<.*?>|&nbsp;', '', Eligibility)
    print(Eligibility)

    parseGPA = GPA(Eligibility, ScholarshipIds[e])
    # parseMajor = Majors(Eligibility)

    print(parseGPA.getGPA())
    # print(parseMajor.getMajors())
Esempio n. 20
0
 def test_verifyMaintains(self):
     testOfMaintain = GPA('Must maintain a $3.0 gpa', '5')
     self.assertIsNotNone(testOfMaintain)
     self.assertEqual("", testOfMaintain.getGPA())
     testOfMaintain = GPA('Must maintain a 3.5', '5')
     self.assertIsNotNone(testOfMaintain)
Esempio n. 21
0
 def doGPAParser(self):
     for line in self.textLines:
         parseGPA = GPA(line)
         if parseGPA.getGPA() != '':
             return parseGPA.getScholarshipPackageRequirementFormat()