test: add offline fixture coverage for Kattis and USACO (#342)

## Problem

Kattis and USACO had zero offline test coverage — no fixtures, no
conftest
routers, and no entries in the test matrix. The `precision` field and
error
paths were also unverified across all platforms.

## Solution

Add HTML fixtures for both platforms and wire up `httpx.AsyncClient.get`
routers in `conftest.py` following the existing CSES/CodeChef pattern.
Extend the test matrix from 12 to 23 parametrized cases. Add a dedicated
test for the Kattis contest-vs-slug fallback path (verifying
`contest_url`
and `standings_url`), three parametrized metadata error cases, and a
targeted assertion that `extract_precision` returns a non-`None` float
for
problems with floating-point tolerance hints.

Closes #281.
This commit is contained in:
Barrett Ruth 2026-03-06 16:49:49 -05:00 committed by GitHub
parent 9727dccc6f
commit 8465e70772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 216 additions and 1 deletions

View file

@ -0,0 +1,10 @@
<html><body><table>
<tr>
<td>A</td>
<td><a href="/contests/open2024/problems/kth2024a">Arithmetic Sequence</a></td>
</tr>
<tr>
<td>B</td>
<td><a href="/contests/open2024/problems/kth2024b">Binary Tree</a></td>
</tr>
</table></body></html>

10
tests/fixtures/kattis/contests.html vendored Normal file
View file

@ -0,0 +1,10 @@
<html><body><table>
<tr>
<td><a href="/contests/open2024">Open 2024</a></td>
<td data-timestamp="1711800000">2024-03-30</td>
</tr>
<tr>
<td><a href="/contests/icpc2023">ICPC 2023</a></td>
<td data-timestamp="1698768000">2023-10-31</td>
</tr>
</table></body></html>

View file

@ -0,0 +1,11 @@
<html>
<head><title>Hello World</title></head>
<body>
<span>CPU Time limit</span><span class="num">1 second</span>
<span>Memory limit</span><span class="num">256 MB</span>
<table class="sample">
<pre>Hello World</pre>
<pre>Hello World</pre>
</table>
</body>
</html>

View file

@ -0,0 +1,17 @@
<html>
<head><title>Arithmetic Sequence</title></head>
<body>
<span>CPU Time limit</span><span class="num">2 seconds</span>
<span>Memory limit</span><span class="num">512 MB</span>
<table class="sample">
<pre>3
1 2 3</pre>
<pre>YES</pre>
</table>
<table class="sample">
<pre>2
1 3</pre>
<pre>NO</pre>
</table>
</body>
</html>

View file

@ -0,0 +1,12 @@
<html>
<head><title>Binary Tree</title></head>
<body>
<span>CPU Time limit</span><span class="num">1 second</span>
<span>Memory limit</span><span class="num">256 MB</span>
<table class="sample">
<pre>5
1 2 3 4 5</pre>
<pre>3</pre>
</table>
</body>
</html>

3
tests/fixtures/usaco/contests.html vendored Normal file
View file

@ -0,0 +1,3 @@
<html><body>
<a href="index.php?page=dec24results">December 2024 Results</a>
</body></html>

14
tests/fixtures/usaco/dec24results.html vendored Normal file
View file

@ -0,0 +1,14 @@
<html><body>
<h2>USACO 2024 December Contest, Gold</h2>
<b>Farmer John's Favorite Problem</b><br/>
<a href="index.php?page=viewproblem2&cpid=1469">View Problem</a>
<b>Binary Indexed Tree</b><br/>
<a href="index.php?page=viewproblem2&cpid=1470">View Problem</a>
<b>Counting Subsequences</b><br/>
<a href="index.php?page=viewproblem2&cpid=1471">View Problem</a>
</body></html>

10
tests/fixtures/usaco/problem_1469.html vendored Normal file
View file

@ -0,0 +1,10 @@
<html><body>
<p>Time limit: 4s. Memory limit: 256 MB.</p>
<p>Given N cows, find the answer.</p>
<pre class="in">3
1 2 3</pre>
<pre class="out">6</pre>
<pre class="in">1
5</pre>
<pre class="out">5</pre>
</body></html>

View file

@ -0,0 +1,7 @@
<html><body>
<p>Time limit: 2s. Memory limit: 512 MB.</p>
<p>Build a binary indexed tree.</p>
<pre class="in">4
1 3 2 4</pre>
<pre class="out">10</pre>
</body></html>

View file

@ -0,0 +1,7 @@
<html><body>
<p>Time limit: 4s. Memory limit: 256 MB.</p>
<p>Output the answer with absolute error at most 10^{-6}.</p>
<pre class="in">2
1 2</pre>
<pre class="out">1.500000</pre>
</body></html>