Skip to content

Commit 64c780f

Browse files
Updates nanoGPT test to use standard regexs
1 parent bcfb737 commit 64c780f

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

tripy/examples/nanogpt/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ for expected accuracy.
3838
<!--
3939
```
4040
(?s).*?
41-
What is the answer to life, the universe, and everything\? How can we know what's real\? How can
42-
====
43-
(?s).*?
44-
What is the answer to life, the universe, and everything\? The answer to the questions that
41+
What is the answer to life, the universe, and everything\? (How can we know what's real\? How can|The answer to the questions that)
4542
```
4643
-->
4744
<!-- Tripy: TEST: EXPECTED_STDOUT End -->
@@ -65,13 +62,7 @@ To run with a quantization mode, pass `--quant-mode` to `example.py`. The suppor
6562
<!--
6663
```
6764
(?s).*?
68-
What is the answer to life, the universe, and everything\? The answer to the questions that
69-
====
70-
(?s).*?
71-
What is the answer to life, the universe, and everything\? How is life possible, what is the meaning of
72-
====
73-
(?s).*?
74-
What is the answer to life, the universe, and everything\? How can
65+
What is the answer to life, the universe, and everything\? (The answer to the questions that|How is life possible, what is the meaning of|How can)
7566
```
7667
-->
7768
<!-- Tripy: TEST: EXPECTED_STDOUT End -->

tripy/tests/test_examples.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,7 @@ def test_examples(example, sandboxed_install_run):
103103
if block.has_marker("test: expected_stdout"):
104104
print("Checking command output against expected output: ", end="")
105105
out = statuses[-1].stdout.strip()
106-
matched = False
107-
expected_outs = dedent(block_text).split("====")
108-
for expected in expected_outs:
109-
if re.match(expected.strip(), out):
110-
matched = True
111-
break
106+
matched = re.match(dedent(block_text).strip(), out)
112107
print("matched!" if matched else "did not match!")
113108
print(f"==== STDOUT ====\n{out}")
114109
assert matched

0 commit comments

Comments
 (0)