Esempio n. 1
0
    def test_singular_or_plural_zero(self) -> None:
        expected = PLURAL_TEXT
        prepared_data = copy(_PREPARED_DATA)

        singular_or_plural(prepared_data, 'zero_value', 'final_text', SINGULAR_TEXT, PLURAL_TEXT)
        actual = prepared_data['final_text']
        self.assertEqual(expected, actual)
Esempio n. 2
0
    def test_singular_or_plural_plural(self) -> None:
        expected = PLURAL_TEXT
        prepared_data = copy(_PREPARED_DATA)

        singular_or_plural(
            prepared_data, "plural_value", "final_text", SINGULAR_TEXT, PLURAL_TEXT
        )
        actual = prepared_data["final_text"]
        self.assertEqual(expected, actual)
Esempio n. 3
0
    def test_singular_or_plural_nonexistent(self) -> None:
        prepared_data = copy(_PREPARED_DATA)

        singular_or_plural(
            prepared_data,
            ALLOWED_METRICS,
            "nonexistent_value",
            "final_text",
            SINGULAR_TEXT,
            PLURAL_TEXT,
        )
        self.assertNotIn("final_text", prepared_data)
Esempio n. 4
0
    def _singular_or_plural_section_headers(self) -> None:
        """Ensures that each of the given labels will be made singular or plural, based on the value it is labelling."""
        allowed_metrics = self.metrics_delegate.singular_or_plural_metrics
        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "pos_discharges",
            "pos_discharges_label",
            "Successful Case Completion",
            "Successful Case Completions",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "earned_discharges",
            "earned_discharges_label",
            "Early Discharge",
            "Early Discharges",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "supervision_downgrades",
            "supervision_downgrades_label",
            "Supervision Downgrade",
            "Supervision Downgrades",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "total_revocations",
            "total_revocations_label",
            "Revocation",
            "Revocations",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "absconsions",
            "absconsions_label",
            "Absconsion",
            "Absconsions",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "assessments",
            "assessments_label",
            "Risk Assessment",
            "Risk Assessments",
        )

        singular_or_plural(
            self.prepared_data,
            allowed_metrics,
            "facetoface",
            "facetoface_label",
            "Face-to-Face Contact",
            "Face-to-Face Contacts",
        )