示例#1
0
def test_text_multiple_text_len(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert len(doc.text_multi_attr) == 2
    assert consume_log[-1] == 'TEST_CLOSE'
    assert not is_partially_loaded(doc)
示例#2
0
def test_text_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_content_attr == u('텍스트 내용')
    assert consume_log[-1] == 'TEXT_CONTENT_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#3
0
def test_text_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_content_attr == u('텍스트 내용')
    assert consume_log[-1] == 'TEXT_CONTENT_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#4
0
def test_text_multiple_text_len(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert len(doc.text_multi_attr) == 2
    assert consume_log[-1] == 'TEST_CLOSE'
    assert not is_partially_loaded(doc)
示例#5
0
def test_multiple_text_getitem_from_last(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_multi_attr[1] == 'b'
    assert consume_log[-1] == 'TEXT_MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_multi_attr[0] == 'a'
    assert consume_log[-1] == 'TEXT_MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#6
0
def test_multiple_text_getitem_from_last(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_multi_attr[1] == 'b'
    assert consume_log[-1] == 'TEXT_MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.text_multi_attr[0] == 'a'
    assert consume_log[-1] == 'TEXT_MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#7
0
def test_document_parse(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.title_attr.value == u('제목 test')
    assert consume_log[-1] == 'TITLE_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.content_attr.value == 'Content test'
    assert consume_log[-1] == 'CONTENT_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert isinstance(doc.multi_attr, collections.Sequence)
示例#8
0
def test_document_parse(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.title_attr.value == u('제목 test')
    assert consume_log[-1] == 'TITLE_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.content_attr.value == 'Content test'
    assert consume_log[-1] == 'CONTENT_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert isinstance(doc.multi_attr, collections.Sequence)
示例#9
0
def test_multiple_child_getitem_from_last(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[2].value == 'c'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[1].value == 'b'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[0].value == 'a'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#10
0
def test_multiple_child_getitem_from_last(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[2].value == 'c'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[1].value == 'b'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert doc.multi_attr[0].value == 'a'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#11
0
def test_read_hints(fx_hinted_doc):
    doc, consume_log = fx_hinted_doc
    assert not doc._hints
    assert is_partially_loaded(doc)
    assert doc._partial == 1
    assert not consume_log or IRON_PYTHON
    doc.title_attr
    assert is_partially_loaded(doc)
    assert doc._partial == 2
    assert consume_log[-1] == 'HINT' or IRON_PYTHON
    assert doc._hints == {
        TestDoc.multi_attr: {'length': '3'},
        TestDoc.sorted_children: {'length': '0'}
    }
示例#12
0
def test_read_hints(fx_hinted_doc):
    doc, consume_log = fx_hinted_doc
    assert not doc._hints
    assert is_partially_loaded(doc)
    assert doc._partial == 1
    assert not consume_log or IRON_PYTHON
    doc.title_attr
    assert is_partially_loaded(doc)
    assert doc._partial == 2
    assert consume_log[-1] == 'HINT' or IRON_PYTHON
    assert doc._hints == {
        TestDoc.multi_attr: {'length': '3'},
        TestDoc.sorted_children: {'length': '0'}
    }
示例#13
0
def test_multiple_child_iter(fx_test_doc):
    doc, consume_log = fx_test_doc
    it = iter(doc.multi_attr)
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    el = next(it)
    assert el.value == 'a'
    assert consume_log[-1] == 'MULTI_1_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    el = next(it)
    assert el.value == 'b'
    assert consume_log[-1] == 'MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    el = next(it)
    assert el.value == 'c'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    with raises(StopIteration):
        next(it)
    assert consume_log[-1] == 'TEST_CLOSE'
    assert not is_partially_loaded(doc)
示例#14
0
def test_multiple_child_iter(fx_test_doc):
    doc, consume_log = fx_test_doc
    it = iter(doc.multi_attr)
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    el = next(it)
    assert el.value == 'a'
    assert consume_log[-1] == 'MULTI_1_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    el = next(it)
    assert el.value == 'b'
    assert consume_log[-1] == 'MULTI_2_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    el = next(it)
    assert el.value == 'c'
    assert consume_log[-1] == 'MULTI_3_CLOSE' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
    assert not is_partially_loaded(el)
    with raises(StopIteration):
        next(it)
    assert consume_log[-1] == 'TEST_CLOSE'
    assert not is_partially_loaded(doc)
示例#15
0
def test_complete(fx_test_doc):
    doc, _ = fx_test_doc
    assert is_partially_loaded(doc)
    complete(doc)
    assert not is_partially_loaded(doc)
示例#16
0
def test_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.attr_attr == u('속성 값')
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#17
0
def test_xmlns_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.ns_element_attr.ns_attr_attr == 'namespace attribute value'
    assert consume_log[-1] == 'NS_ELEMENT_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#18
0
def test_attribute_decoder(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.attr_decoder == 'decoder test'
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#19
0
def test_content_decoder(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.content_decoder.value == 'CONTENT DECODER'
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#20
0
def test_content_decoder(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.content_decoder.value == 'CONTENT DECODER'
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#21
0
def test_attribute_decoder(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.attr_decoder == 'decoder test'
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#22
0
def test_xmlns_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.ns_element_attr.ns_attr_attr == 'namespace attribute value'
    assert consume_log[-1] == 'NS_ELEMENT_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#23
0
def test_attribute(fx_test_doc):
    doc, consume_log = fx_test_doc
    assert doc.attr_attr == u('속성 값')
    assert consume_log[-1] == 'TEST_START' or IRON_PYTHON
    assert is_partially_loaded(doc) or IRON_PYTHON
示例#24
0
def test_complete(fx_test_doc):
    doc, _ = fx_test_doc
    assert is_partially_loaded(doc)
    complete(doc)
    assert not is_partially_loaded(doc)