-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted normalize str and created tests
- Loading branch information
1 parent
cf2808f
commit d6ed0bb
Showing
4 changed files
with
58 additions
and
19 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
Empty file.
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,35 @@ | ||
import pytest | ||
|
||
from rangy.exceptions import ParseRangeError | ||
from rangy import parse_range | ||
from rangy.parse import _nomalize_str | ||
|
||
|
||
def test_str_single_integer(): | ||
assert parse_range("5") == (5, 5) | ||
|
||
def test_normalize_str_basic(): | ||
assert _nomalize_str("1-5") == ("1", "5") | ||
assert _nomalize_str("(1-5)") == ("1", "5") | ||
assert _nomalize_str("[1-5]") == ("1", "5") | ||
|
||
def test_normalize_str_with_spaces(): | ||
assert _nomalize_str(" 1 - 5 ") == ("1", "5") | ||
assert _nomalize_str("[ 1 - 5 ]") == ("1", "5") | ||
assert _nomalize_str("( 1 - 5 )") == ("1", "5") | ||
|
||
def test_normalize_str_with_commas(): | ||
assert _nomalize_str("1,5") == ("1", "5") | ||
assert _nomalize_str("(1,5)") == ("1", "5") | ||
assert _nomalize_str("[1,5]") == ("1", "5") | ||
|
||
def test_normalize_str_with_semicolons(): | ||
assert _nomalize_str("1;5") == ("1", "5") | ||
assert _nomalize_str("(1;5)") == ("1", "5") | ||
assert _nomalize_str("[1;5]") == ("1", "5") | ||
|
||
def test_normalize_str_single_value(): | ||
assert _nomalize_str("5") == ("5",) | ||
assert _nomalize_str("(5)") == ("5",) | ||
assert _nomalize_str("[5]") == ("5",) | ||
|
This file was deleted.
Oops, something went wrong.