Beispiel #1
0
 def loadPurchase(self, pageNumber):
     ParserBase.__init__(self, 'purchaseMethod', "p=true&d-4031123-p=%i" % pageNumber)
     skipValue = u"Все способы"
     contenttable = self.soup.find('table', {'class': 'maintable', 'id': 'resultTable'})
     for method in (val.text.strip().lower() \
                    for val in contenttable.findAll('td', {'class': 'purchaseValue'}) \
                    if val.text.find(skipValue) == -1):
         yield method
Beispiel #2
0
 def __init__(self, purchaseParams):
     ParserBase.__init__(self, 'purchase', purchaseParams)
     self.purchaseID = 0
     for purchaseParam in purchaseParams.split("&"):
         try:
             key, val = purchaseParam.split("=")[:2]
             if key == "purchaseId":
                 self.purchaseID = int(val)
                 break
         except:
             pass
Beispiel #3
0
 def __init__(self, protocolParams):
     ParserBase.__init__(self, 'viewProtocols', protocolParams)
     self.protocolInfoID = 0
     for protocolParam in protocolParams.split("&"):
         try:
             key, val = protocolParam.split("=")[:2]
             if key == "protocolInfoId":
                 self.protocolInfoID = int(val)
                 break
         except ValueError:
             pass
 def allEntriesForPage(self, pageNumber):
     ParserBase.__init__(self, 'organizationSearchForm', "d-442831-p=%i" % pageNumber)
     contenttable = self.soup.find('table', {'class': 'maintable', 'id':'agency'})
     headers = [th.text.strip() for th in contenttable.thead.tr.findAll('th') if th.text.strip() != ""]
     headers.append('URL')
     url = ''
     for tr in contenttable.tbody.findAll('tr'):
         values = []
         tds = tr.findAll('td')
         for td in tds:
             values.append(td.text.strip().replace('\"', ''))
         url = tds[0].find('a')['onclick'].strip()
         url = url[url.index('\'') + 1: url.rindex('\'')]
         values.append(url)
         resDict = dict(zip(headers, values))
         yield resDict
         pass
Beispiel #5
0
def main():
    testCases = [
        ["x", ">", "y"], ["x"], ["x", "+", "y"],
        ["x", "+", "y", ">=", "x", "*", "(", "y", "-", "3", ")"],
        ["y", ">", "(", "y", "-", "3",
         ")"], ["x", "<", "y", "AND", "y", "<",
                "z"],
        [
            "x", ">", "y", "AND", "[", "y", "=", "z", "OR", "y", "=", "z", "*",
            "(", "x", "+", "1", ")", "]"
        ],
        [
            "FORALL", "x", "::", "[", "x", "<", "5", "IMP", "x", "*", "x", "<",
            "25", "]"
        ], ["FORALL", "x", "::", "x", ">", "y"],
        ["FORALL", "x", "::", "[", "x", "AND", "y",
         "]"],
        ["EXISTS", "y", "::", "[", "FORALL", "x", "::", "x", ">", "y", "]"],
        ["EXISTS", "y", "::", "[", "FORALL", "x", "::", "x", ">", "y"],
        ["x", "+", "y", ">", "yz", "+", "xxx"],
        ["(", "x", "+", "y", ")", "*", "z", ">", "yz", "+", "xxx"],
        ["(", "x", "+", "y", "*", "z", ">", "yz", "+", "xxx"],
        ["x", "+", "(", "y", "*", "z", ")", ">", "yz", "+", "xxx"],
        ["x", "*", "y", "=", "qr"], ["x", "y"]
    ]
    expectedValue = [
        True, False, False, True, True, True, True, True, True, False, True,
        False, True, True, False, True, True, False
    ]
    Flag = False
    for i in range(0, 18):
        currentTestCase = ParserBase(testCases[i])
        currentExpectedValue = expectedValue[i]
        # print("Sim(%s,%s) is %s" %(masterFile,comparingTextfiles[i],sim))
        print("Case%s :" % (i + 1))
        if (currentExpectedValue == currentTestCase.parse(currentTestCase.s)):
            print("PASSED")
        else:
            print("FAILED")
            Flag = True
    if (Flag == True):
        print("There is test case failed")
    else:
        print("All test cases passed")
Beispiel #6
0
 def __init__(self):
     ParserBase.__init__(self, 'searchForm', "d-3771889-p=%i&purchaseStages=%s" % (1, "APPLICATION_FILING"))
     self.searchUrl = "%s%s?%s" % (globals.urlBase, globals.urlPaths['searchForm'], "d-3771889-p=%i&purchaseStages=%s")
 def __init__(self):
     ParserBase.__init__(self, 'organizationSearchForm', "d-442831-p=%i" % 1)
     self.searchUrl = "%s%s?%s" % (globals.urlBase, globals.urlPaths['organizationSearchForm'], "d-442831-p=%i")