def test_query_function_with_txt_file(self): result = dp.highlight_doc("document_highlight_test_txt_file.txt","Mathematical",source_type=True) self.assertEqual("Mathematicians resolve the truth or falsity of conjectures by [[HIGHLIGHT]] mathematical [[ENDHIGHLIGHT]] proofs, which are arguments sufficient to convince other mathematicians of their validity. The research required to solve [[HIGHLIGHT]] mathematical [[ENDHIGHLIGHT]] problems can",result)
def test_query_function_with_exceeds_maximum_length(self): result = dp.highlight_doc("Hello Big Data Partnership. My name is Robert, and I am a Data scientist. Hello Big Data Partnership. My name is Robert, Data scientist. Hello Big Data Partnership. My name is Robert, and I am a Data scientist. Hello Big Data Partnership. My Big Data scientist","Big Data",output_length=34) self.assertEqual("Hello [[HIGHLIGHT]] Big Data [[ENDHIGHLIGHT]] Partnership. My name is Robert, and I am a [[HIGHLIGHT]] Data [[ENDHIGHLIGHT]] scientist. Hello [[HIGHLIGHT]] Big Data [[ENDHIGHLIGHT]] Partnership. My name is Robert, [[HIGHLIGHT]] Data [[ENDHIGHLIGHT]] scientist. Hello [[HIGHLIGHT]] Big Data [[ENDHIGHLIGHT]]",result)
def test_provided_example(self): string = "I like fish. Little star's deep dish pizza sure is fantastic. Dogs are funny." result = dp.highlight_doc(string, "deep dish pizza") self.assertEqual("Little star's [[HIGHLIGHT]] deep dish pizza [[ENDHIGHLIGHT]] sure is fantastic.",result)
def test_query_function_with_string_argument(self): result = dp.highlight_doc("Hello Big Data Partnership. My name is Robert, and I am a Data scientist.","Big Data",output_length=34) self.assertEqual("Hello [[HIGHLIGHT]] Big Data [[ENDHIGHLIGHT]] Partnership. My name is Robert, and I am a [[HIGHLIGHT]] Data [[ENDHIGHLIGHT]] scientist.",result)