update invited tab
Browse files- invited.py +0 -5
- tests/test_invited.py +11 -61
invited.py
CHANGED
|
@@ -200,11 +200,6 @@ def document(token: str | None) -> str:
|
|
| 200 |
|
| 201 |
by_sub = {(st["track"], st["division"]): st for st in rep["subtracks"]}
|
| 202 |
|
| 203 |
-
# No counts anywhere on this tab (Harry, 2026-08-08): not a seat total, not
|
| 204 |
-
# a team total, not a per-card "N invited". The tables ARE the count, and a
|
| 205 |
-
# printed figure beside them is a second copy that can only disagree with
|
| 206 |
-
# them. It also removes the reason this page had to read `distinct_teams`
|
| 207 |
-
# out of the shortlist file at all.
|
| 208 |
out.append("<p class='lb-note'>"
|
| 209 |
"A team is invited per sub-track, so a team may appear in several. "
|
| 210 |
"If your team is listed, register it in <b>Submit → Test → "
|
|
|
|
| 200 |
|
| 201 |
by_sub = {(st["track"], st["division"]): st for st in rep["subtracks"]}
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
out.append("<p class='lb-note'>"
|
| 204 |
"A team is invited per sub-track, so a team may appear in several. "
|
| 205 |
"If your team is listed, register it in <b>Submit → Test → "
|
tests/test_invited.py
CHANGED
|
@@ -1,11 +1,4 @@
|
|
| 1 |
-
"""Tests for the Invited to Test Phase tab.
|
| 2 |
-
|
| 3 |
-
Written 2026-08-08 after the first version shipped with no tests and three
|
| 4 |
-
visible defects: the iframe never grew past its default height so the page was
|
| 5 |
-
cut off partway down the second of six tables, the intro line ran off the right
|
| 6 |
-
edge, and each table sized to its own content so the columns stepped left and
|
| 7 |
-
right between sub-tracks. Each of those is pinned below.
|
| 8 |
-
"""
|
| 9 |
|
| 10 |
import os
|
| 11 |
import re
|
|
@@ -35,8 +28,8 @@ def _report(n_subtracks=2, rows_per=3, note_rows=0):
|
|
| 35 |
]
|
| 36 |
for k in range(note_rows):
|
| 37 |
shortlist.append({
|
| 38 |
-
"rank": rows_per + k + 1, "team_name": "
|
| 39 |
-
"hf_user": "
|
| 40 |
"primary_score": 1.0, "total_params": 1,
|
| 41 |
"note": "organizer smoke test",
|
| 42 |
})
|
|
@@ -48,8 +41,7 @@ def _report(n_subtracks=2, rows_per=3, note_rows=0):
|
|
| 48 |
"primary_is_self_reported": False,
|
| 49 |
"shortlist": shortlist,
|
| 50 |
})
|
| 51 |
-
return {"
|
| 52 |
-
"subtracks": subs}
|
| 53 |
|
| 54 |
|
| 55 |
def _full_report():
|
|
@@ -68,7 +60,7 @@ def _full_report():
|
|
| 68 |
"total_params": 7_000_000_000,
|
| 69 |
}],
|
| 70 |
})
|
| 71 |
-
return {"
|
| 72 |
|
| 73 |
|
| 74 |
def _doc(rep):
|
|
@@ -83,7 +75,6 @@ class DocumentIsWellFormedTest(unittest.TestCase):
|
|
| 83 |
self.assertTrue(d.rstrip().endswith("</html>"), d[-40:])
|
| 84 |
|
| 85 |
def test_the_empty_state_is_also_a_complete_document(self):
|
| 86 |
-
"""The no-shortlist branch returned early and closed nothing."""
|
| 87 |
d = _doc(None)
|
| 88 |
self.assertTrue(d.startswith("<!DOCTYPE html>"))
|
| 89 |
self.assertTrue(d.rstrip().endswith("</html>"))
|
|
@@ -93,24 +84,20 @@ class DocumentIsWellFormedTest(unittest.TestCase):
|
|
| 93 |
d = _doc(_report(n_subtracks=2))
|
| 94 |
for tag in ("div", "table", "thead", "tbody", "tr", "th", "td"):
|
| 95 |
# `<th` also prefixes `<thead`, so match the tag name followed by a
|
| 96 |
-
# delimiter rather than
|
| 97 |
opens = len(re.findall(rf"<{tag}[\s>]", d))
|
| 98 |
self.assertEqual(opens, d.count(f"</{tag}>"), tag)
|
| 99 |
|
| 100 |
|
| 101 |
class SelfSizingTest(unittest.TestCase):
|
| 102 |
-
"""The page was cut off partway down. This is why."""
|
| 103 |
-
|
| 104 |
def test_the_content_is_wrapped_in_the_element_the_script_measures(self):
|
| 105 |
d = _doc(_report())
|
| 106 |
self.assertEqual(1, d.count("id='invroot'"))
|
| 107 |
-
# the wrapper must close before the script, or the script is inside it
|
| 108 |
self.assertIn("</div><script>", d)
|
| 109 |
|
| 110 |
def test_it_measures_the_wrapper_not_the_document(self):
|
| 111 |
"""documentElement.scrollHeight is bounded below by the iframe's own
|
| 112 |
-
viewport, so feeding it back into the iframe height grows without
|
| 113 |
-
bound. results.board_document() hit this first; do not reintroduce it.
|
| 114 |
"""
|
| 115 |
d = _doc(_report())
|
| 116 |
self.assertIn("getElementById('invroot')", d)
|
|
@@ -128,15 +115,7 @@ class SelfSizingTest(unittest.TestCase):
|
|
| 128 |
|
| 129 |
|
| 130 |
class GridLayoutTest(unittest.TestCase):
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
Six full-width tables stacked vertically did not match the Validation tab
|
| 134 |
-
and read as six unrelated tables. The layout is now the boards' own: one
|
| 135 |
-
.lb-track per track, each holding a 2-up .lb-grid of Small | Large, so the
|
| 136 |
-
six sub-tracks sit 3 down by 2 across.
|
| 137 |
-
"""
|
| 138 |
-
|
| 139 |
-
def test_one_track_section_per_track_not_one_per_sub_track(self):
|
| 140 |
d = _doc(_full_report())
|
| 141 |
self.assertEqual(len(config.TRACKS), d.count('class="lb-track"'))
|
| 142 |
self.assertEqual(len(config.TRACKS), d.count('class="lb-grid"'))
|
|
@@ -153,11 +132,8 @@ class GridLayoutTest(unittest.TestCase):
|
|
| 153 |
self.assertIn("minmax(min(100%,460px),1fr)", d)
|
| 154 |
|
| 155 |
def test_it_uses_the_same_class_names_as_the_boards(self):
|
| 156 |
-
"""
|
| 157 |
-
|
| 158 |
-
results.py is read as TEXT rather than imported: importing it pulls in
|
| 159 |
-
pandas, which made this test fail on any interpreter without it, for a
|
| 160 |
-
reason that has nothing to do with the property being checked.
|
| 161 |
"""
|
| 162 |
here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 163 |
with open(os.path.join(here, "results.py"), encoding="utf-8") as fh:
|
|
@@ -184,36 +160,10 @@ class GridLayoutTest(unittest.TestCase):
|
|
| 184 |
class ContentTest(unittest.TestCase):
|
| 185 |
def test_organizer_rows_are_filtered_by_their_note_field(self):
|
| 186 |
d = _doc(_report(n_subtracks=1, rows_per=2, note_rows=1))
|
| 187 |
-
self.assertNotIn("
|
| 188 |
self.assertIn("Team 00", d)
|
| 189 |
self.assertIn("Team 01", d)
|
| 190 |
|
| 191 |
-
def test_no_counts_are_printed_anywhere(self):
|
| 192 |
-
"""Harry, 2026-08-08: no seat total, no team total, no per-card count.
|
| 193 |
-
|
| 194 |
-
The tables are the count. A printed figure beside them is a second copy
|
| 195 |
-
that can only disagree with them, and it used to disagree three ways at
|
| 196 |
-
once, because neither team names nor accounts reproduce the transitive
|
| 197 |
-
identity merge.
|
| 198 |
-
"""
|
| 199 |
-
text = re.sub(r"<[^>]+>", " ", _doc(_full_report()))
|
| 200 |
-
for pattern in (r"\d+\s*seats", r"\d+\s*teams", r"\d+\s*invited",
|
| 201 |
-
r"across\s+\d+"):
|
| 202 |
-
self.assertEqual([], re.findall(pattern, text, re.I), pattern)
|
| 203 |
-
|
| 204 |
-
def test_the_card_head_is_just_the_division(self):
|
| 205 |
-
d = _doc(_full_report())
|
| 206 |
-
heads = set(re.findall(r'lb-board-head">([^<]*)<', d))
|
| 207 |
-
self.assertEqual({"Small", "Large"}, heads)
|
| 208 |
-
|
| 209 |
-
def test_it_no_longer_needs_the_count_from_the_shortlist_file(self):
|
| 210 |
-
"""Dropping the counts removed the only reason to read that field."""
|
| 211 |
-
rep = _full_report()
|
| 212 |
-
rep.pop("distinct_teams")
|
| 213 |
-
rep.pop("total_seats")
|
| 214 |
-
d = _doc(rep)
|
| 215 |
-
self.assertIn("lb-board", d)
|
| 216 |
-
|
| 217 |
def test_rows_are_ordered_by_rank(self):
|
| 218 |
rep = _report(n_subtracks=1, rows_per=3)
|
| 219 |
rep["subtracks"][0]["shortlist"].reverse()
|
|
|
|
| 1 |
+
"""Tests for the Invited to Test Phase tab."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
import re
|
|
|
|
| 28 |
]
|
| 29 |
for k in range(note_rows):
|
| 30 |
shortlist.append({
|
| 31 |
+
"rank": rows_per + k + 1, "team_name": "organizer-fixture",
|
| 32 |
+
"hf_user": "organizer-fixture", "model_name": "smoke",
|
| 33 |
"primary_score": 1.0, "total_params": 1,
|
| 34 |
"note": "organizer smoke test",
|
| 35 |
})
|
|
|
|
| 41 |
"primary_is_self_reported": False,
|
| 42 |
"shortlist": shortlist,
|
| 43 |
})
|
| 44 |
+
return {"subtracks": subs}
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
def _full_report():
|
|
|
|
| 60 |
"total_params": 7_000_000_000,
|
| 61 |
}],
|
| 62 |
})
|
| 63 |
+
return {"subtracks": subs}
|
| 64 |
|
| 65 |
|
| 66 |
def _doc(rep):
|
|
|
|
| 75 |
self.assertTrue(d.rstrip().endswith("</html>"), d[-40:])
|
| 76 |
|
| 77 |
def test_the_empty_state_is_also_a_complete_document(self):
|
|
|
|
| 78 |
d = _doc(None)
|
| 79 |
self.assertTrue(d.startswith("<!DOCTYPE html>"))
|
| 80 |
self.assertTrue(d.rstrip().endswith("</html>"))
|
|
|
|
| 84 |
d = _doc(_report(n_subtracks=2))
|
| 85 |
for tag in ("div", "table", "thead", "tbody", "tr", "th", "td"):
|
| 86 |
# `<th` also prefixes `<thead`, so match the tag name followed by a
|
| 87 |
+
# delimiter rather than counting the opening bracket.
|
| 88 |
opens = len(re.findall(rf"<{tag}[\s>]", d))
|
| 89 |
self.assertEqual(opens, d.count(f"</{tag}>"), tag)
|
| 90 |
|
| 91 |
|
| 92 |
class SelfSizingTest(unittest.TestCase):
|
|
|
|
|
|
|
| 93 |
def test_the_content_is_wrapped_in_the_element_the_script_measures(self):
|
| 94 |
d = _doc(_report())
|
| 95 |
self.assertEqual(1, d.count("id='invroot'"))
|
|
|
|
| 96 |
self.assertIn("</div><script>", d)
|
| 97 |
|
| 98 |
def test_it_measures_the_wrapper_not_the_document(self):
|
| 99 |
"""documentElement.scrollHeight is bounded below by the iframe's own
|
| 100 |
+
viewport, so feeding it back into the iframe height grows without bound.
|
|
|
|
| 101 |
"""
|
| 102 |
d = _doc(_report())
|
| 103 |
self.assertIn("getElementById('invroot')", d)
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
class GridLayoutTest(unittest.TestCase):
|
| 118 |
+
def test_one_track_section_per_track(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
d = _doc(_full_report())
|
| 120 |
self.assertEqual(len(config.TRACKS), d.count('class="lb-track"'))
|
| 121 |
self.assertEqual(len(config.TRACKS), d.count('class="lb-grid"'))
|
|
|
|
| 132 |
self.assertIn("minmax(min(100%,460px),1fr)", d)
|
| 133 |
|
| 134 |
def test_it_uses_the_same_class_names_as_the_boards(self):
|
| 135 |
+
"""results.py is read as text: importing it pulls in pandas, which has
|
| 136 |
+
nothing to do with the property being checked.
|
|
|
|
|
|
|
|
|
|
| 137 |
"""
|
| 138 |
here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 139 |
with open(os.path.join(here, "results.py"), encoding="utf-8") as fh:
|
|
|
|
| 160 |
class ContentTest(unittest.TestCase):
|
| 161 |
def test_organizer_rows_are_filtered_by_their_note_field(self):
|
| 162 |
d = _doc(_report(n_subtracks=1, rows_per=2, note_rows=1))
|
| 163 |
+
self.assertNotIn("organizer-fixture", d)
|
| 164 |
self.assertIn("Team 00", d)
|
| 165 |
self.assertIn("Team 01", d)
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
def test_rows_are_ordered_by_rank(self):
|
| 168 |
rep = _report(n_subtracks=1, rows_per=3)
|
| 169 |
rep["subtracks"][0]["shortlist"].reverse()
|