Skip to content

Commit 58ae6a5

Browse files
committed
Fix tests
1 parent 0fb8949 commit 58ae6a5

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

examples/checkbox_other.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
choices=["Computers", "Books", "Science", "Nature", "Fantasy", "History"],
1515
default=["Computers", "Books"],
1616
other=True,
17+
carousel=True,
1718
),
1819
]
1920

tests/acceptance/test_checkbox.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,32 @@ def setUp(self):
8989
self.sut.expect("Computers.*", timeout=1)
9090

9191
def test_other_input(self):
92+
self.sut.send(key.UP)
93+
self.sut.expect(r"\+ Other\.\.\..*", timeout=1)
9294
self.sut.send(key.SPACE)
95+
self.sut.expect(r": ", timeout=1)
9396
self.sut.send("Hello world")
97+
self.sut.expect(r"Hello world.*", timeout=1)
9498
self.sut.send(key.ENTER)
99+
self.sut.expect(r"> X Hello world[\s\S]*\+ Other\.\.\..*", timeout=1)
95100
self.sut.send(key.ENTER)
96-
self.sut.expect(r"{'interests': \['Computers', 'Books', 'Hello world'\]}.*", timeout=1) # noqa
101+
self.sut.expect(r"{'interests': \['Computers', 'Books', 'Hello world'\]}", timeout=1) # noqa
97102

98103
def test_other_blank_input(self):
104+
self.sut.send(key.UP)
105+
self.sut.expect(r"\+ Other\.\.\..*", timeout=1)
99106
self.sut.send(key.SPACE)
100-
self.sut.send(key.ENTER) # blank input
101-
self.sut.send(key.SPACE)
102-
self.sut.send("Hello world")
107+
self.sut.expect(r": ", timeout=1)
108+
self.sut.send(key.ENTER) # blank input
109+
self.sut.expect(r"> \+ Other\.\.\..*", timeout=1)
103110
self.sut.send(key.ENTER)
104-
self.sut.send(key.ENTER)
105-
self.sut.expect(r"{'interests': \['Computers', 'Books', 'Hello world'\]}.*", timeout=1) # noqa
111+
self.sut.expect(r"{'interests': \['Computers', 'Books'\]}", timeout=1) # noqa
106112

107113
def test_other_select_choice(self):
108-
self.sut.send(key.DOWN)
109114
self.sut.send(key.SPACE)
115+
self.sut.expect(r"[^X] Computers.*", timeout=1)
110116
self.sut.send(key.ENTER)
111-
self.sut.expect(r"{'interests': \['Books'\]}.*", timeout=1) # noqa
117+
self.sut.expect(r"{'interests': \['Books'\]}", timeout=1) # noqa
112118

113119

114120
@unittest.skipUnless(sys.platform.startswith("lin"), "Linux only")

tests/acceptance/test_list.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,30 @@ def setUp(self):
6464
self.sut.expect("Standard.*", timeout=1)
6565

6666
def test_other_input(self):
67+
self.sut.send(key.UP)
68+
self.sut.expect(r"\+ Other\.\.\..*", timeout=1)
6769
self.sut.send(key.ENTER)
70+
self.sut.expect(r": ", timeout=1)
6871
self.sut.send("Hello world")
72+
self.sut.expect(r"Hello world", timeout=1)
6973
self.sut.send(key.ENTER)
7074
self.sut.expect("{'size': 'Hello world'}.*", timeout=1)
7175

7276
def test_other_blank_input(self):
77+
self.sut.send(key.UP)
78+
self.sut.expect(r"\+ Other\.\.\..*", timeout=1)
7379
self.sut.send(key.ENTER)
80+
self.sut.expect(r": ", timeout=1)
7481
self.sut.send(key.ENTER) # blank input
82+
self.sut.expect(r"\+ Other\.\.\..*", timeout=1)
7583
self.sut.send(key.ENTER)
84+
self.sut.expect(r": ", timeout=1)
7685
self.sut.send("Hello world")
86+
self.sut.expect(r"Hello world", timeout=1)
7787
self.sut.send(key.ENTER)
7888
self.sut.expect("{'size': 'Hello world'}.*", timeout=1)
7989

8090
def test_other_select_choice(self):
81-
self.sut.send(key.DOWN)
8291
self.sut.send(key.ENTER)
8392
self.sut.expect("{'size': 'Jumbo'}.*", timeout=1)
8493

0 commit comments

Comments
 (0)