-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test file for helper functions
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
|
||
from catmux.session import check_boolean_field | ||
from catmux.tmux_wrapper import _safe_call as safe_call | ||
|
||
|
||
def test_boolean_field(): | ||
assert check_boolean_field("yes") == True | ||
assert check_boolean_field("Yes") == True | ||
assert check_boolean_field("YES") == True | ||
assert check_boolean_field("true") == True | ||
assert check_boolean_field("True") == True | ||
assert check_boolean_field("TRUE") == True | ||
assert check_boolean_field("t") == True | ||
assert check_boolean_field("T") == True | ||
assert check_boolean_field("1") == True | ||
assert check_boolean_field("no") == False | ||
assert check_boolean_field("No") == False | ||
assert check_boolean_field("NO") == False | ||
assert check_boolean_field("false") == False | ||
assert check_boolean_field("False") == False | ||
assert check_boolean_field("FALSE") == False | ||
assert check_boolean_field(True) == True | ||
assert check_boolean_field(False) == False | ||
|
||
|
||
def test_safe_call(): | ||
assert safe_call(["bash", "-c", "exit 0"]) == True | ||
assert safe_call(["bash", "-c", "exit 1"]) == False | ||
assert safe_call(["bash", "-c", "return 0"]) == False # illegal bash |