-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ui: fix display of syntax and semantic errors
Improve display of syntax and semantic errors. Closes #281
- Loading branch information
1 parent
3555144
commit 4fdbfc8
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Tests for build related exceptions.""" | ||
import pytest | ||
|
||
import stan | ||
|
||
|
||
def test_semantic_error(): | ||
# wrong number of arguments to `uniform` | ||
program_code = "parameters { real y; } model { y ~ uniform(10, 20, 30); }" "" | ||
with pytest.raises(ValueError, match=r"Semantic error"): | ||
stan.build(program_code, random_seed=1) | ||
|
||
|
||
def test_syntax_error(): | ||
program_code = "parameters { real y; } model { y ~ uniform(10| 20); }" "" | ||
with pytest.raises(ValueError, match=r"Syntax error"): | ||
stan.build(program_code, random_seed=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters