Пример #1
0
 def test_mql_stress(self):
     seed("playadito vs amanda... 3 focas")
     for _ in xrange(100):
         expression = random_expression()
         target, mql = generate_mql(expression)
         self._valid_mql_query(mql)
         self._valid_target_for_query(target, mql)
 def test_sparql_ascii_stress(self):
     seed("sacala dunga dunga dunga")
     for _ in xrange(100):
         expression = random_expression(only_ascii=True)
         _, s = expression_to_sparql(expression)
         self._standard_check(s, expression)
         self._sparql_check(s)
Пример #3
0
 def test_mql_stress(self):
     seed("playadito vs amanda... 3 focas")
     for _ in xrange(100):
         expression = random_expression()
         target, mql = generate_mql(expression)
         self._valid_mql_query(mql)
         self._valid_target_for_query(target, mql)
    def test_sparql_stress(self):
        seed("sacala dunga dunga dunga")
        for _ in xrange(100):
            expression = random_expression()
            try:
                _, s = expression_to_sparql(expression)
            except ValueError as error:
                if "Unable to generate sparql" in str(error):
                    continue

            self._standard_check(s, expression)
            self._sparql_check(s)
Пример #5
0
    def test_dot_stress(self):
        seed("I have come here to chew bubblegum and kick ass... "
             "and I'm all out of bubblegum.")
        dot_file = tempfile.NamedTemporaryFile()
        cmdline = "dot %s" % dot_file.name
        msg = "dot returned error code {}, check {} input file."
        for _ in xrange(100):
            expression = random_expression()
            _, dot_string = expression_to_dot(expression)
            with open(dot_file.name, "w") as filehandler:
                filehandler.write(dot_string.encode("utf-8"))

            try:
                retcode = subprocess.call(cmdline.split(),
                                          stdout=tempfile.TemporaryFile())
            except OSError:
                print "Warning: the program 'dot' was not found, tests skipped"
                return
            if retcode != 0:
                dot_file.delete = False
            self.assertEqual(retcode, 0, msg.format(retcode, dot_file.name))
Пример #6
0
    def test_dot_stress(self):
        seed("I have come here to chew bubblegum and kick ass... "
             "and I'm all out of bubblegum.")
        dot_file = tempfile.NamedTemporaryFile()
        cmdline = "dot %s" % dot_file.name
        msg = "dot returned error code {}, check {} input file."
        for _ in xrange(100):
            expression = random_expression()
            _, dot_string = expression_to_dot(expression)
            with open(dot_file.name, "w") as filehandler:
                filehandler.write(dot_string.encode("utf-8"))

            try:
                retcode = subprocess.call(cmdline.split(),
                                          stdout=tempfile.TemporaryFile())
            except OSError:
                print "Warning: the program 'dot' was not found, tests skipped"
                return
            if retcode != 0:
                dot_file.delete = False
            self.assertEqual(retcode, 0, msg.format(retcode, dot_file.name))