Beispiel #1
0
def test_recentChanges():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)
    ob = system.allobjects['basic.mod.D.f']
    root.newDocstring('xxx', ob, '"""Tee hee."""')
    # just "assertNotRaises"
    getTextOfPage(root, 'recentChanges')
Beispiel #2
0
def test_diff_newDocstring():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    ob = system.allobjects['basic.mod.D.f']

    root.newDocstring('xxx', ob, '"""Tee hee."""')

    args = {'ob': ob.fullName(), 'revA': 0, 'revB': 1}
    html = getTextOfPage(root, 'diff', args)
    assert '+        """Tee hee."""' in html
Beispiel #3
0
def test_history():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    ob = system.allobjects['basic.mod.C']

    performEdit(root, ob, repr("This *is* a docstring"))

    args = {'ob': ob.fullName()}
    historytext = getTextOfPage(root, 'history', args)
    assert "*is*" in historytext
Beispiel #4
0
def test_diff():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    ob = system.allobjects['basic.mod.C']

    performEdit(root, ob, repr("This *is* a docstring"))

    args = {'ob': ob.fullName(), 'revA': '0', 'revB': '1'}
    difftext = getTextOfPage(root, 'diff', args)
    assert "*is*" in difftext
Beispiel #5
0
def test_edit_direct():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    ob = system.allobjects['basic.mod.C']
    docstring = root.currentDocstringForObject(ob)
    assert docstring == ob.docstring

    newDocstring = '"""This *is* a docstring"""'
    root.newDocstring('xxx', ob, newDocstring)
    docstring = root.currentDocstringForObject(ob)
    assert docstring == eval(newDocstring)
    assert ob.docstring != docstring
Beispiel #6
0
def test_edit_renders_ok():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)
    args = {'ob': 'basic'}
    result = getTextOfPage(root, 'edit', args=args)
    assert '# pre comment -7' not in result
    assert '# pre comment -6' in result
    assert '# pre comment -1' in result
    assert '# post comment 1' in result
    assert '# post comment 6' in result
    assert '# post comment 7' not in result

    args = {'ob': 'does.not.exist'}
    result = getTextOfPage(root, 'edit', args=args)
    assert 'An error occurred' in result
Beispiel #7
0
def test_docstrings_from_superclass():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    html = getTextOfPage(root, 'basic.mod.D.html')
    assert 'Method docstring of C.f' in html

    ob = system.allobjects['basic.mod.D.f']
    root.newDocstring('xxx', ob, repr('Method docstring of D.f.'))

    html = getTextOfPage(root, 'basic.mod.D.html')
    assert 'Method docstring of C.f' not in html

    ob = system.allobjects['basic.mod.D.f']
    root.newDocstring('xxx', ob, '')

    html = getTextOfPage(root, 'basic.mod.D.html')
    assert 'Method docstring of C.f' in html
Beispiel #8
0
def test_edit():
    system = processPackage('basic')
    root = server.EditingPyDoctorResource(system)

    ob = system.allobjects['basic.mod.C']
    docstring = root.currentDocstringForObject(ob)
    assert docstring == ob.docstring

    newDocstring = '"""This *is* a docstring"""'
    performEdit(root, ob, newDocstring)
    docstring = root.currentDocstringForObject(ob)
    assert docstring == eval(newDocstring)
    assert ob.docstring != docstring

    result = getTextOfPage(root, 'basic.mod.C.html')
    assert eval(newDocstring) in result

    result = getTextOfPage(root, 'basic.mod.html')
    assert eval(newDocstring) in result