Пример #1
0
 def test_data_access_attribute_with_text_class(self):
     datas = MyDatas({"test_info": "test text"})
     document = Document(datas)
     section = document.new_section()
     text_class = TextClass(section)
     text_class.text = text_class.free_text(text_class.test_info)
     assert str(text_class) == "test text"
Пример #2
0
 def test_data_access_non_existing_attribute(self):
     datas = MyDatas({"test_info": "test text"})
     document = Document(datas)
     section = document.new_section()
     text_class = TextClass(section)
     with pytest.raises(AttributeError):
         text_class.text = text_class.free_text(text_class.test_missing)
Пример #3
0
 def test_text_class_free_text(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.free_text("test")
     assert str(text_class) == "test"
Пример #4
0
 def test_text_class_post_eval(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.post_eval("TEST", "test", "")
     section.write()
     assert section.html.xpath('//div')[0].text_content() == ""
Пример #5
0
 def test_text_class_iter_elems(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.nlg_iter([["iter", "elem"]])
     assert str(text_class) == "iter et elem"
Пример #6
0
 def test_text_class_no_interpret(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.no_interpret(" ")
     assert str(text_class) == "#SPACE#"
Пример #7
0
 def test_text_class_number(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.nlg_num(154)
     assert str(text_class) == "154"
Пример #8
0
 def test_text_class_synonym(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.nlg_syn(["syno"])
     assert str(text_class) == "*1*"
Пример #9
0
 def test_text_class_nlg_tag(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = text_class.nlg_tags("b", "test")
     assert str(text_class) == "<b>test</b>"
Пример #10
0
 def test_text_class_write_get_section_text(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = "test"
     text_class.text = "test"
     assert str(section.text) == "test test"
Пример #11
0
 def test_text_class_list(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = ["test", "test"]
     assert str(text_class) == "test test"
Пример #12
0
 def test_text_class_text_2(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     text_class.text = "test"
     text_class.text = "test"
     assert str(text_class) == "test test"
Пример #13
0
 def test_empty_text_class(self):
     document, section = create_empty_section()
     text_class = TextClass(section)
     assert str(text_class) == ""