parselinenos() raise errors for "10-1" range

This commit is contained in:
Takeshi KOMIYA
2017-02-12 22:12:53 +09:00
parent 0e9c2e6027
commit f562af06b2
2 changed files with 8 additions and 3 deletions

View File

@@ -105,9 +105,12 @@ def test_parselinenos():
assert parselinenos('7-9', 10) == [6, 7, 8]
assert parselinenos('7-', 10) == [6, 7, 8, 9]
assert parselinenos('1,7-', 10) == [0, 6, 7, 8, 9]
assert parselinenos('7-7', 10) == [6]
with pytest.raises(ValueError):
parselinenos('1-2-3', 10)
with pytest.raises(ValueError):
parselinenos('abc-def', 10)
with pytest.raises(ValueError):
parselinenos('-', 10)
with pytest.raises(ValueError):
parselinenos('3-1', 10)