-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afe5c1a
commit 149e468
Showing
6 changed files
with
105 additions
and
10 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
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,30 @@ | ||
import pytest | ||
import pyteal as pt | ||
|
||
|
||
def test_version(): | ||
for i in range(10): | ||
version_pragma = pt.TealPragma(version=i) | ||
assert version_pragma._name == "version" | ||
assert version_pragma._value == i | ||
assert version_pragma.assemble() == f"#pragma version {i}" | ||
assert repr(version_pragma) == f"TealPragma(version={i})" | ||
|
||
|
||
def test_type_track(): | ||
for value in (True, False): | ||
type_track_pragma = pt.TealPragma(type_track=value) | ||
assert type_track_pragma._name == "typetrack" | ||
assert type_track_pragma._value == str(value).lower() | ||
assert type_track_pragma.assemble() == f"#pragma typetrack {str(value).lower()}" | ||
assert repr(type_track_pragma) == f"TealPragma(type_track={value})" | ||
|
||
|
||
def test_empty(): | ||
with pytest.raises(ValueError): | ||
pt.TealPragma() | ||
|
||
|
||
def test_both(): | ||
with pytest.raises(ValueError): | ||
pt.TealPragma(version=1, type_track=True) |
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