Download tasks/t29-friction-three-dots/tests/test_label_text.py from refreshdotdev/Refresh-GUI-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/refreshdotdev/Refresh-GUI-dataset/resolve/main/tasks/t29-friction-three-dots/tests/test_label_text.py
- Command line
-
hf download hf://datasets/refreshdotdev/Refresh-GUI-dataset/tasks/t29-friction-three-dots/tests/test_label_text.py
-
curl -L -o test_label_text.py https://huggingface.co/datasets/refreshdotdev/Refresh-GUI-dataset/resolve/main/tasks/t29-friction-three-dots/tests/test_label_text.py
1.03 kB
| """Label wording controls: frozen reference, wrong category and absent label.""" | |
| import json | |
| import unittest | |
| from pathlib import Path | |
| import numpy as np | |
| import visual_score | |
| class LabelText(unittest.TestCase): | |
| def test_reference_words_are_readable(self): | |
| here = Path(__file__).parent/'reference' | |
| config = json.loads((here/'diagnostic-config.json').read_text()) | |
| with np.load(here/'reference-frames.npz') as data: | |
| for name in config['category_order']: | |
| with self.subTest(name=name): | |
| self.assertEqual(visual_score.label_text_check(data[name], name)[0], 0) | |
| def test_wrong_category_and_missing_label(self): | |
| with np.load(Path(__file__).parent/'reference/reference-frames.npz') as data: | |
| self.assertEqual(visual_score.label_text_check(data['dot-elastic'], 'dot-pulse')[0], 1) | |
| self.assertEqual(visual_score.label_text_check(np.zeros((300,216,384),np.uint8), 'dot-elastic')[0], 1) | |
| if __name__ == '__main__': | |
| unittest.main() | |