Skip to content

Commit

Permalink
Merge pull request #64 from Bjwebb/improve-code-quality
Browse files Browse the repository at this point in the history
Refine dummy XML in light of changes to comprehensiveness logic aa0be1b
  • Loading branch information
dalepotter committed Aug 5, 2015
2 parents 1e83379 + 958515a commit ebb35fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions stats/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ def empty_or_percentage_sum_is_100(path, by_vocab=False):
else:
return len(elements) == 1 or sum(decimal_or_zero(x.attrib.get('percentage')) for x in elements) == 100


bools.update({
'version': bools['version'] and self.element.getparent().attrib['version'] in CODELISTS[self._major_version()]['Version'],
'iati-identifier': bools['iati-identifier'] and reporting_org_ref and self.element.find('iati-identifier').text.startswith(reporting_org_ref),
Expand Down
12 changes: 8 additions & 4 deletions stats/tests/test_comprehensiveness.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def test_comprehensiveness_with_validation(key, major_version):
<reporting-org ref="BBB"/>
<iati-identifier>AAA-1</iati-identifier>
<participating-org role="Implementing"/>
<activity-status code="2" />
<activity-status />
<activity-date iso-date="9990-05-01" />
<!-- Must have at least one activity-date of type start-planned or start-actual with valid date -->
<activity-date type="end-planned" iso-date="2014-01-01" />
Expand Down Expand Up @@ -544,11 +544,11 @@ def test_comprehensiveness_with_validation(key, major_version):
<reporting-org ref="BBB"/>
<iati-identifier>AAA-1</iati-identifier>
<participating-org role="4"/><!-- Implementing -->
<activity-status code="2" />
<activity-status />
<activity-date iso-date="9990-05-01" />
<!-- Must have at least one activity-date of type start-planned or start-actual with valid date -->
<activity-date type="end-planned" iso-date="2014-01-01" />
<activity-date type="start-planned" iso-date="2014-0101" />
<activity-date type="3" iso-date="2014-01-01" />
<activity-date type="1" iso-date="2014-0101" />
<sector vocabulary="1" percentage="100" code="a" />
<sector vocabulary="1" percentage="100" code="b" />
<sector vocabulary="2" percentage="100" code="a" />
Expand Down Expand Up @@ -590,7 +590,9 @@ def test_comprehensiveness_with_validation(key, major_version):
<reporting-org ref="AAA"/>
<iati-identifier>AAA-1</iati-identifier>
<participating-org role="Funding"/>
<activity-status code="2" />
<!-- Must have at least one activity-date in the past year (if 'end-actual') or in the future (if type 'end-planned') -->
<activity-date iso-date="2014-01-01" type="start-planned" />
<activity-date iso-date="2015-06-01" type="end-planned" />
<sector vocabulary="DAC" percentage="50" code="11220" />
<sector vocabulary="DAC" percentage="50" code="11240" />
Expand Down Expand Up @@ -632,7 +634,9 @@ def test_comprehensiveness_with_validation(key, major_version):
<reporting-org ref="AAA"/>
<iati-identifier>AAA-1</iati-identifier>
<participating-org role="1"/><!-- Funding -->
<activity-status code="2" />
<!-- Must have at least one activity-date in the past year (if '4') or in the future (if type '3') -->
<activity-date iso-date="2014-01-01" type="1" />
<activity-date iso-date="2015-06-01" type="3" />
<sector vocabulary="1" percentage="50" code="11220" />
<sector vocabulary="1" percentage="50" code="11240" />
Expand Down

0 comments on commit ebb35fa

Please sign in to comment.