civics-cdf-validator 1.56.dev2__tar.gz → 1.56.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {civics_cdf_validator-1.56.dev2/civics_cdf_validator.egg-info → civics_cdf_validator-1.56.dev4}/PKG-INFO +1 -1
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/rules.py +44 -2
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/version.py +1 -1
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/README.md +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/__init__.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/base.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/loggers.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/office_utils.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/setup.cfg +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/setup.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/stats.py +0 -0
- {civics_cdf_validator-1.56.dev2 → civics_cdf_validator-1.56.dev4}/validator.py +0 -0
|
@@ -4329,7 +4329,7 @@ class SourceDirPathMustBeSetAfterInitialDeliveryDate(base.BaseRule):
|
|
|
4329
4329
|
)
|
|
4330
4330
|
|
|
4331
4331
|
|
|
4332
|
-
class
|
|
4332
|
+
class OfficeholderSubFeedDatesAreSequential(base.DateRule):
|
|
4333
4333
|
"""Dates in an OfficeHolderSubFeed element should be sequential."""
|
|
4334
4334
|
|
|
4335
4335
|
def elements(self):
|
|
@@ -4720,6 +4720,47 @@ class NoExtraElectionReportCollections(base.BaseRule):
|
|
|
4720
4720
|
)
|
|
4721
4721
|
|
|
4722
4722
|
|
|
4723
|
+
class FeedElementsShouldHaveSubElementsBasedOnType(base.BaseRule):
|
|
4724
|
+
"""Feeds should have certain elements based on feed type.
|
|
4725
|
+
|
|
4726
|
+
For example, Feeds of type officeHolder should have an OfficeHolderSubFeed,
|
|
4727
|
+
similarly pre-election and election-results feeds should have an
|
|
4728
|
+
ElectionEventCollection. In the case of an ElectionEventCollection, at least
|
|
4729
|
+
one ElectionEvent element should be present.
|
|
4730
|
+
"""
|
|
4731
|
+
|
|
4732
|
+
def elements(self):
|
|
4733
|
+
return ["Feed"]
|
|
4734
|
+
|
|
4735
|
+
def check(self, element):
|
|
4736
|
+
feed_type = element.find("FeedType")
|
|
4737
|
+
feed_id = element.find("FeedId").text
|
|
4738
|
+
|
|
4739
|
+
if not element_has_text(feed_type):
|
|
4740
|
+
return
|
|
4741
|
+
|
|
4742
|
+
feed_type = feed_type.text
|
|
4743
|
+
if feed_type == "officeholder":
|
|
4744
|
+
if element.find("OfficeholderSubFeed") is None:
|
|
4745
|
+
raise loggers.ElectionError.from_message(
|
|
4746
|
+
"OfficeholderSubFeed should exist for %s feed %s."
|
|
4747
|
+
% (feed_type, feed_id)
|
|
4748
|
+
)
|
|
4749
|
+
elif feed_type == "pre-election" or feed_type == "election-results":
|
|
4750
|
+
if element.find("ElectionEventCollection") is None:
|
|
4751
|
+
raise loggers.ElectionError.from_message(
|
|
4752
|
+
"ElectionEventCollection should exist for %s feed %s."
|
|
4753
|
+
% (feed_type, feed_id)
|
|
4754
|
+
)
|
|
4755
|
+
if not element.find("ElectionEventCollection").findall(
|
|
4756
|
+
"ElectionEvent"
|
|
4757
|
+
):
|
|
4758
|
+
raise loggers.ElectionError.from_message(
|
|
4759
|
+
"ElectionEventCollection should have at least one ElectionEvent"
|
|
4760
|
+
" for %s feed %s." % (feed_type, feed_id)
|
|
4761
|
+
)
|
|
4762
|
+
|
|
4763
|
+
|
|
4723
4764
|
class RuleSet(enum.Enum):
|
|
4724
4765
|
"""Names for sets of rules used to validate a particular feed type."""
|
|
4725
4766
|
|
|
@@ -4875,12 +4916,13 @@ METADATA_RULES = (
|
|
|
4875
4916
|
# go/keep-sorted start
|
|
4876
4917
|
ElectionEventDatesAreSequential,
|
|
4877
4918
|
Encoding,
|
|
4919
|
+
FeedElementsShouldHaveSubElementsBasedOnType,
|
|
4878
4920
|
FeedHasValidCountryCode,
|
|
4879
4921
|
FeedIdsAreUnique,
|
|
4880
4922
|
FeedInactiveDateIsLatestDate,
|
|
4881
4923
|
FeedInactiveDateSetForNonEvergreenFeed,
|
|
4882
4924
|
FeedTypeHasValidFeedLongevity,
|
|
4883
|
-
|
|
4925
|
+
OfficeholderSubFeedDatesAreSequential,
|
|
4884
4926
|
OptionalAndEmpty,
|
|
4885
4927
|
Schema,
|
|
4886
4928
|
SourceDirPathMustBeSetAfterInitialDeliveryDate,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|