Total Complexity | 1 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
2 | from io import StringIO |
||
3 | from dvnv.utils import clean_input |
||
4 | |||
5 | PROMPT = "Input: " |
||
6 | |||
7 | |||
8 | def test_clean_input(monkeypatch): |
||
9 | monkeypatch.setattr("sys.stdin", StringIO(" left SPACE\n")) |
||
10 | assert clean_input(PROMPT) == "left space" |
||
11 | |||
12 | monkeypatch.setattr("sys.stdin", StringIO("RIGHT space \n")) |
||
13 | assert clean_input(PROMPT) == "right space" |
||
14 | |||
15 | monkeypatch.setattr("sys.stdin", StringIO(" SURROUNDING SPACE \n")) |
||
16 | assert clean_input(PROMPT) == "surrounding space" |
||
17 |