Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sherifzain committed May 30, 2018
1 parent 1a9ba48 commit 3a84431
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,29 @@ def test_nesting():
'an_int': 10,
},
}


def test_numeric_var_with_spaces():
"""Test that numbers are parsed properly even if they have spaces."""
args = {
'an_int': Var(use=int, load_from='AN_INT',),
}

os.environ['AN_INT'] = '0 '

assert parse_env(args) == {
'an_int': 0,
}


def test_string_var_with_spaces():
"""Test that string values are truncated."""
args = {
'a_var': Var(use=str, load_from='A_VAR',),
}

os.environ['A_VAR'] = ' username\n'

assert parse_env(args) == {
'a_var': 'username',
}

0 comments on commit 3a84431

Please sign in to comment.