Download testbed/django__django/tests/db_functions/math/test_random.py from hc99/FEA-Bench: direct link, hf CLI and curl.
- Browser
- Download file 401 Bytes
-
https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/django__django/tests/db_functions/math/test_random.py
- Command line
-
hf download hf://datasets/hc99/FEA-Bench/testbed/django__django/tests/db_functions/math/test_random.py
-
curl -L -o test_random.py https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/django__django/tests/db_functions/math/test_random.py
401 Bytes
| from django.db.models.functions import Random | |
| from django.test import TestCase | |
| from ..models import FloatModel | |
| class RandomTests(TestCase): | |
| def test(self): | |
| FloatModel.objects.create() | |
| obj = FloatModel.objects.annotate(random=Random()).first() | |
| self.assertIsInstance(obj.random, float) | |
| self.assertGreaterEqual(obj.random, 0) | |
| self.assertLess(obj.random, 1) | |