Ejemplo n.º 1
0
 def test_false(self):
     with open(self.filename,'w') as f:
         f.write("maths\tpass\t60\nscience\tpass\t5\n")
     self.assertTrue(iofunctions.marks_changed(["maths","science"],["pass","fail"],["60","5"],root=ROOT))
Ejemplo n.º 2
0
    names = []
    for a in soup.find_all("a",id = re.compile("CLASS_NAME")):
        names.append(unicode(a.string))

    descriptions = []
    for div in soup.find_all("div",id = re.compile("DERIVED_SSS_SCL_UP_GRANTOR_DESCR")):
        descriptions.append(unicode(div.span.string))

    grades = []
    for div in soup.find_all("div",id = re.compile("DERIVED_SSS_SCL_UP_GRADE")):
        grades.append(unicode(div.span.string))


    # check whether grades have changed
    if iofunctions.marks_changed(names,descriptions,grades):
        # make tab sepperated values strings
        big_string = ''
        for i, name in enumerate(names):
            big_string += name + '\t'
            big_string += descriptions[i] + '\t'
            big_string += grades[i] + '\n'

        # save
        with open(root+'/marks.txt','w') as file:
            file.write(big_string.encode("UTF-8"))

        # open
        import webbrowser
        webbrowser.open(root+"/marks.txt")
        
Ejemplo n.º 3
0
 def test_first_run(self):
     self.assertTrue(iofunctions.marks_changed(["maths","science"],["pass","pass"],["60","5"],root=ROOT))