Exemple #1
0
def get_doc(mod):
    """Returns a test document."""
    # Reset module state.
    tt.reset(mod)

    # Create.
    doc = _decode_from_xml_metafor_cim_v1(mod.DOC_FILE, mod.DOC_TYPE,
                                          mod.DOC_PROJECT, mod.DOC_INSTITUTE)

    # Extend.
    pyesdoc.extend(doc)

    # Verify.
    assert_doc(mod, doc)

    return doc
Exemple #2
0
def _test_module_reset(mod):
    """Test that the test document modules are correctly reset."""
    # Assert module state is cached.
    assert mod in tt.INITIAL_STATE

    # Update state.
    for field in tt.STATE_FIELDS:
        setattr(mod, field, 'XXX')
        tu.assert_str(getattr(mod, field), 'XXX')

    # Reset.
    tt.reset(mod)

    # Assert initial state.
    for field in tt.STATE_FIELDS:
        state = tt.INITIAL_STATE[mod][field]
        assert getattr(mod, field) == state
Exemple #3
0
def _test_module_reset(mod):
    """Test that the test document modules are correctly reset."""
    # Assert module state is cached.
    assert mod in tt.INITIAL_STATE

    # Update state.
    for field in tt.STATE_FIELDS:
        setattr(mod, field, 'XXX')
        tu.assert_str(getattr(mod, field), 'XXX')

    # Reset.
    tt.reset(mod)

    # Assert initial state.
    for field in tt.STATE_FIELDS:
        state = tt.INITIAL_STATE[mod][field]
        assert getattr(mod, field) == state
Exemple #4
0
def get_doc(mod):
    """Returns a test document."""
    # Reset module state.
    tt.reset(mod)

    # Create.
    doc = _decode_from_xml_metafor_cim_v1(mod.DOC_FILE,
                                          mod.DOC_TYPE,
                                          mod.DOC_PROJECT,
                                          mod.DOC_INSTITUTE)

    # Extend.
    pyesdoc.extend(doc)

    # Verify.
    assert_doc(mod, doc)

    return doc