• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemocracyClub / yournextrepresentative / 61fa0e65-e434-4cb1-af79-01fad7e23b35

02 Apr 2024 05:15PM UTC coverage: 68.182% (+0.9%) from 67.282%
61fa0e65-e434-4cb1-af79-01fad7e23b35

Pull #2269

circleci

symroe
Add LoggedActions for ElectionSOPNs and add smoke tests
Pull Request #2269: Redesign SOPN models

1735 of 2910 branches covered (59.62%)

Branch coverage included in aggregate %.

356 of 417 new or added lines in 20 files covered. (85.37%)

27 existing lines in 5 files now uncovered.

7055 of 9982 relevant lines covered (70.68%)

0.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/ynr/apps/sopn_parsing/management/commands/sopn_parsing_extract_page_numbers.py
1
from elections.models import Election
1✔
2
from pdfminer.pdftypes import PDFException
1✔
3
from sopn_parsing.helpers.command_helpers import BaseSOPNParsingCommand
1✔
4
from sopn_parsing.helpers.extract_pages import extract_pages_for_election_sopn
1✔
5
from sopn_parsing.helpers.text_helpers import NoTextInDocumentError
1✔
6

7

8
class Command(BaseSOPNParsingCommand):
1✔
9
    help = """
1✔
10
    Parse documents to extract and set relevant pages from documents that have
11
    more than one ballot paper
12

13
    Default is to only parse documents for current electons that haven't
14
    already been parsed. Use `all-documents` and `reparse` to change this.
15

16
    """
17

18
    def handle(self, *args, **options):
1✔
19
        qs = Election.objects.all().exclude(electionsopn=None)
1✔
20

21
        filter_kwargs = {}
1✔
22
        if options.get("election_slugs"):
1!
NEW
23
            filter_kwargs["slug__in"] = options.get("election_slugs").split(",")
×
24

25
        if options["current"]:
1!
NEW
26
            filter_kwargs["current"] = True
×
27

28
        if options["date"]:
1!
NEW
29
            filter_kwargs["election_date"] = options["date"]
×
30

31
        qs = qs.filter(**filter_kwargs)
1✔
32

33
        for election in qs:
1✔
34
            try:
1✔
35
                extract_pages_for_election_sopn(election.electionsopn)
1✔
36
            except (
×
37
                ValueError,
38
                NoTextInDocumentError,
39
                PDFException,
40
                FileNotFoundError,
41
            ) as e:
42
                try:
×
43
                    self.stderr.write(e.args[0])
×
44
                except AttributeError:
×
45
                    self.stderr.write(str(e))
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc