Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug for integers in sunsch substitute #666

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/subscript/sunsch/sunsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class InsertStatement(BaseModel):
template: Optional[FilePath] = None
days: Optional[float] = None
string: Optional[str] = None
substitute: Optional[Dict[str, Union[str, float, str]]] = None
substitute: Optional[Dict[str, Union[int, float, str]]] = None


class SunschConfig(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sunsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def test_main(testdata, caplog, mocker):
# Check for foo1.sch, A-1 should occur twice
assert sum("A-1" in x for x in schlines) == 2

# Check for substitutetest:
assert any("400000" in x for x in schlines)
# Check for substitutetest, the last 1 has to be integer as it is a table index:
assert any("'A-90' 'OPEN' 'ORAT' 3000 0 400000 1 /" in x for x in schlines)

# Check for randomid:
assert any("A-4" in x for x in schlines)
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata_sunsch/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ insert:
-
template: footemplate.sch
days: 2
substitute: {ORAT: 3000, GRAT: 400000}
substitute: {ORAT: 3000, GRAT: 400000, VFP: 1}
# -
# template: footemplate.sch
#days: 4
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata_sunsch/footemplate.sch
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
WCONHIST
'A-90' 'OPEN' 'ORAT' <ORAT> <GRAT> /
'A-90' 'OPEN' 'ORAT' <ORAT> 0 <GRAT> <VFP>/
/
Loading