예제 #1
0
def test_convert_text_to_uri_and_back():
    text_from_file = open(__file__).read()
    doc = Document(content=text_from_file, mime_type='text/x-python')
    assert doc.text
    doc.convert_text_to_uri()
    doc.convert_uri_to_text()
    assert doc.text == text_from_file
예제 #2
0
def test_convert_uri_to_text(uri, mimetype):
    doc = Document(uri=uri, mime_type=mimetype)
    doc.convert_uri_to_text()
    if mimetype == 'text/html':
        assert '<!doctype html>' in doc.text
    elif mimetype == 'text/x-python':
        text_from_file = open(__file__).read()
        assert doc.text == text_from_file
예제 #3
0
def test_convert_uri_to_text():
    t = open(__file__).read()
    d = Document(content=t, mime_type='text/x-python')
    assert d.text
    d.convert_text_to_uri()
    d.text = ''
    assert not d.text
    d.convert_uri_to_text()
    assert d.text == t