Skip to content

Commit f118274

Browse files
roed314claude
andcommitted
Trim the test_search comments
The parsing-bug history and the index-prefix reasoning belong in the commit message and the PR, not in the file. Keep only what a reader of the test needs: why each filter is asserted both ways, why labels carry their tags, and why the last search tolerates a timeout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent a38c544 commit f118274

1 file changed

Lines changed: 7 additions & 26 deletions

File tree

lmfdb/characters/test_characters.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,13 @@ def test_modbrowse(self):
3535
assert '46.d' in W.get_data(as_text=True)
3636

3737
def test_search(self):
38-
# The primitivity and parity filters are read from is_primitive=yes|no
39-
# and parity=even|odd; the older primitive=Yes|No and parity=Odd|Even
40-
# spellings set nothing at all, so searches using them silently ran the
41-
# unfiltered query and asserted labels that were on its first page
42-
# anyway. Every filter below is therefore checked in both directions,
43-
# by a label it must keep and one it must drop, so a parameter that
44-
# stops being parsed widens the search and fails here.
45-
#
46-
# Labels are matched with their surrounding tags: 416 is also a multiple
47-
# of 16, so a bare '16.e' would match the '416.e' further down the page.
48-
#
49-
# Fixing both conductor and order matches an index prefix, which leaves
50-
# the index supplying the sort as well, so all of these come back from a
51-
# handful of index entries.
38+
# Each filter is checked in both directions, so a parameter that stops
39+
# being parsed widens the search and trips a negative assertion.
40+
# Conductor 16, order 4 has a primitive even orbit (16.e), a primitive
41+
# odd one (16.f), and imprimitive counterparts at modulus 32. Labels
42+
# carry their tags, since a bare '16.e' also matches '416.e'.
5243
page = self.tc.get('/Character/Dirichlet/?conductor=15&order=4').get_data(as_text=True)
5344
assert '>15.e<' in page
54-
# conductor 16 and order 4 gives a primitive even orbit (16.e), a
55-
# primitive odd one (16.f), and imprimitive even and odd ones at
56-
# modulus 32, so each filter is visible in the labels it selects. All
57-
# four are asserted present by one filtered search or another, so no
58-
# unfiltered control page is needed.
5945
page = self.tc.get('/Character/Dirichlet/?conductor=16&order=4&is_primitive=no').get_data(as_text=True)
6046
assert '>32.e<' in page and '>32.f<' in page
6147
assert '>16.e<' not in page and '>16.f<' not in page
@@ -68,13 +54,8 @@ def test_search(self):
6854
page = self.tc.get('/Character/Dirichlet/?conductor=16&order=4&is_primitive=no&parity=odd').get_data(as_text=True)
6955
assert '>32.f<' in page
7056
assert '>16.e<' not in page and '>16.f<' not in page and '>32.e<' not in page
71-
# Ranges match no index prefix, so this one matches every modulus
72-
# admitting a character of conductor 25 to 50, upwards of half a million
73-
# orbits, every one of which is read before the sort by modulus can pick
74-
# the first page. It is the only search here that costs that, and the
75-
# only one allowed to settle for the timeout page. Range parsing is
76-
# also covered cheaply by test_order and test_modbrowse, which range
77-
# over a single column.
57+
# A conductor range matches no index prefix, so this one reads every
58+
# orbit of conductor 25-50 before it can sort; allow the timeout page.
7859
self.check_args_with_timeout(
7960
'/Character/Dirichlet/?conductor=25-50&order=5-7', '>25.d<')
8061

0 commit comments

Comments
 (0)