Datasets:
Download test_iceland_dataset.py from guicybercode/iceland-tech-christian-ethics-prompts: direct link, hf CLI and curl.
- Browser
- Download file 2.26 kB
-
https://huggingface.co/datasets/guicybercode/iceland-tech-christian-ethics-prompts/resolve/main/test_iceland_dataset.py
- Command line
-
hf download hf://datasets/guicybercode/iceland-tech-christian-ethics-prompts/test_iceland_dataset.py
-
curl -L -o test_iceland_dataset.py https://huggingface.co/datasets/guicybercode/iceland-tech-christian-ethics-prompts/resolve/main/test_iceland_dataset.py
2.26 kB
| """Regression tests for the bilingual microdataset validator. | |
| SPDX-License-Identifier: MIT | |
| """ | |
| from __future__ import annotations | |
| import copy | |
| import unittest | |
| from validate_iceland import ( | |
| DEFAULT_DATA, | |
| _read_jsonl, | |
| validate_records, | |
| validate_repository, | |
| ) | |
| class MicrodatasetValidationTests(unittest.TestCase): | |
| def setUpClass(cls) -> None: | |
| cls.records, cls.read_errors = _read_jsonl(DEFAULT_DATA) | |
| def test_release_candidate_is_structurally_valid(self) -> None: | |
| self.assertEqual(self.read_errors, []) | |
| self.assertEqual(validate_repository(), []) | |
| def test_missing_translation_breaks_pair_completeness(self) -> None: | |
| errors = validate_records(copy.deepcopy(self.records[:-1])) | |
| self.assertTrue(any("exactly 24 records" in error for error in errors)) | |
| self.assertTrue(any("exactly one pt-BR and one en" in error for error in errors)) | |
| def test_pluralism_cannot_be_disabled(self) -> None: | |
| records = copy.deepcopy(self.records) | |
| records[0]["pluralism"]["required"] = False | |
| errors = validate_records(records) | |
| self.assertTrue(any("pluralism safeguard must be required" in error for error in errors)) | |
| def test_incomplete_review_focus_is_rejected(self) -> None: | |
| records = copy.deepcopy(self.records) | |
| records[0]["creation"]["review_focus"] = ["cultural-sensitivity"] | |
| errors = validate_records(records) | |
| self.assertTrue(any("review_focus is incomplete" in error for error in errors)) | |
| def test_malformed_creation_object_is_reported_without_crashing(self) -> None: | |
| records = copy.deepcopy(self.records) | |
| records[0]["creation"] = {"method": "ai-generated-original-draft"} | |
| errors = validate_records(records) | |
| self.assertTrue(any("invalid creation object" in error for error in errors)) | |
| def test_universalizing_religious_claim_is_rejected(self) -> None: | |
| records = copy.deepcopy(self.records) | |
| records[0]["perspectives"][0]["argument"] += " All Christians believe this." | |
| errors = validate_records(records) | |
| self.assertTrue(any("prohibited universalizing" in error for error in errors)) | |
| if __name__ == "__main__": | |
| unittest.main() | |