示例#1
0
def test_version_detection_no_parent():
    """
    Tests that XML with no parent returns default version.
    """

    activity = ActivityStats()

    activity.element = etree.fromstring('''
        <iati-activity>
        </iati-activity>
    ''')

    assert activity._version() == '1.01'
示例#2
0
def test_version_detection_valid(version):
    """
    Tests that valid versions of the IATI Standard are detected.
    """

    activity = ActivityStats()

    tree = etree.fromstring('''
        <iati-activities version="{0}">
           <iati-activity>
           </iati-activity>
        </iati-activities>
    '''.format(version))

    activity.element = tree.getchildren()[0]

    assert activity._version() == version
示例#3
0
def test_version_detection_no_version_attrib():
    """
    Tests that XML with no version attribute returns default version.
    """

    activity = ActivityStats()

    tree = etree.fromstring('''
        <iati-activities>
           <iati-activity>
           </iati-activity>
        </iati-activities>
    ''')

    activity.element = tree.getchildren()[0]

    assert activity._version() == '1.01'