kind=space (fixed oblique 3D: points, vectors, planes, box) + ~190 figured questions for grade 12 (geometry, discrete, calculus)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 01:04:08 +03:30
parent 998b68e4bc
commit 733796c25a
4 changed files with 6434 additions and 2 deletions

View File

@@ -461,3 +461,29 @@ class FifthRoundTests(SimpleTestCase):
self.assertEqual((item['type'], item['shape'], item['w'], item['top'], item['h']), ('quad', 'trapezoid', 10.0, 6.0, 4.0))
item = parse('{"kind":"rectangle","length":8,"width":5}')['items'][0]
self.assertEqual((item['w'], item['h']), (8.0, 5.0))
class SpaceDiagramTests(SimpleTestCase):
"""kind=space: فضای سه‌بعدیِ ثابت؛ ورودیِ خراب حذف می‌شود و چیزی از بیرون به SVG نمی‌رسد."""
def test_valid_space_keeps_points_and_items(self):
spec = {'kind': 'space', 'title': 'بردار', 'points': {'A': [1, 2, 3]},
'items': [{'type': 'vector', 'from': 'O', 'to': 'A', 'label': 'a', 'color': 'blue'},
{'type': 'drop', 'point': 'A'}, {'type': 'box', 'to': [1, 2, 3]}]}
out = validate(spec)
self.assertEqual(out['kind'], 'space')
self.assertEqual(out['points']['O'], [0.0, 0.0, 0.0])
self.assertEqual([i['type'] for i in out['items']], ['vector', 'drop', 'box'])
def test_bad_items_are_dropped_not_trusted(self):
out = validate({'kind': 'space', 'points': {'A': [1, 2, 3], 'B': [1, 2], 'C': [1e9, 0, 0]},
'items': [{'type': 'vector', 'from': 'A', 'to': 'B'}, # B نامعتبر
{'type': 'script', 'src': 'x'}, # نوعِ ناشناخته
{'type': 'segment', 'from': 'O', 'to': 'A', 'color': '<b>'},
{'type': 'polygon', 'points': ['A', 'O']}]}) # کمتر از سه نقطه
self.assertEqual(out['items'], [{'type': 'segment', 'from': 'O', 'to': 'A'}])
self.assertNotIn('B', out['points'])
self.assertNotIn('C', out['points'])
def test_empty_space_is_rejected(self):
self.assertIsNone(validate({'kind': 'space', 'points': {}, 'items': []}))