Ejemplo n.º 1
0
 def test_strip_text_from_html__for_statement_python(self):
     a = LanguagesAPI()
     result, code = a.http_request_using_urlfetch(
         "https://docs.python.org/2/reference/compound_stmts.html#the-for-statement",
         {})
     b = ResultParser("Python")
     res = b.strip_text_from_html(result)
     self.assertNotIn("<", res, "The result contains tags!")
Ejemplo n.º 2
0
 def test_find_by_id_get_for_statement_python(self):
     """
     Test getting translation for "for statement" in python from html by given id
     """
     a = LanguagesAPI()
     result, code = a.http_request_using_urlfetch("https://docs.python.org/2/reference/compound_stmts.html#the-for-statement", {})
     b = ResultParser("Python")
     res = b.find_by_id(result, 'the-for-statement')
     self.assertNotEqual(res, "", "The result is empty string!")
Ejemplo n.º 3
0
 def test__find_by_p_get_for_statement_c(self):
     """
     Test getting translation for "for statement" in c from html by given p
     """
     a = LanguagesAPI()
     cntb = "for"  # code needed to be translated
     result, code = a.http_request_using_urlfetch("http://www.tutorialspoint.com/cprogramming/c_for_loop.htm", {})
     b = ResultParser("c")
     res = b.find_by_p(result)
     print res
     self.assertTrue(cntb in res)
Ejemplo n.º 4
0
 def test_find_by_id_get_for_statement_python(self):
     """
     Test getting translation for "for statement" in python from html by given id
     """
     a = LanguagesAPI()
     result, code = a.http_request_using_urlfetch(
         "https://docs.python.org/2/reference/compound_stmts.html#the-for-statement",
         {})
     b = ResultParser("Python")
     res = b.find_by_id(result, 'the-for-statement')
     self.assertNotEqual(res, "", "The result is empty string!")
Ejemplo n.º 5
0
 def test__find_by_p_get_for_statement_c(self):
     """
     Test getting translation for "for statement" in c from html by given p
     """
     a = LanguagesAPI()
     cntb = "for"  # code needed to be translated
     result, code = a.http_request_using_urlfetch(
         "http://www.tutorialspoint.com/cprogramming/c_for_loop.htm", {})
     b = ResultParser("c")
     res = b.find_by_p(result)
     print res
     self.assertTrue(cntb in res)
Ejemplo n.º 6
0
 def test_strip_text_from_html__for_statement_python(self):
     a = LanguagesAPI()
     result, code = a.http_request_using_urlfetch("https://docs.python.org/2/reference/compound_stmts.html#the-for-statement", {})
     b = ResultParser("Python")
     res = b.strip_text_from_html(result)
     self.assertNotIn("<", res, "The result contains tags!")