|
3 | 3 | import re |
4 | 4 | import sys |
5 | 5 | import typing as t |
6 | | -from typing import Optional |
7 | 6 |
|
8 | 7 | import pytest |
9 | 8 |
|
@@ -181,19 +180,25 @@ def test_tmux_cmd_unicode(session: Session) -> None: |
181 | 180 | session.cmd("new-window", "-t", 3, "-n", "юникод", "-F", "Ελληνικά") |
182 | 181 |
|
183 | 182 |
|
| 183 | +class SessionCheckName(t.NamedTuple): |
| 184 | + session_name: t.Optional[str] |
| 185 | + raises: bool |
| 186 | + exc_msg_regex: t.Optional[str] |
| 187 | + |
| 188 | + |
184 | 189 | @pytest.mark.parametrize( |
185 | | - "session_name,raises,exc_msg_regex", |
| 190 | + SessionCheckName._fields, |
186 | 191 | [ |
187 | | - ("", True, "may not be empty"), |
188 | | - (None, True, "may not be empty"), |
189 | | - ("my great session.", True, "may not contain periods"), |
190 | | - ("name: great session", True, "may not contain colons"), |
191 | | - ("new great session", False, None), |
192 | | - ("ajf8a3fa83fads,,,a", False, None), |
| 192 | + SessionCheckName("", True, "may not be empty"), |
| 193 | + SessionCheckName(None, True, "may not be empty"), |
| 194 | + SessionCheckName("my great session.", True, "may not contain periods"), |
| 195 | + SessionCheckName("name: great session", True, "may not contain colons"), |
| 196 | + SessionCheckName("new great session", False, None), |
| 197 | + SessionCheckName("ajf8a3fa83fads,,,a", False, None), |
193 | 198 | ], |
194 | 199 | ) |
195 | 200 | def test_session_check_name( |
196 | | - session_name: Optional[str], raises: bool, exc_msg_regex: Optional[str] |
| 201 | + session_name: t.Optional[str], raises: bool, exc_msg_regex: t.Optional[str] |
197 | 202 | ) -> None: |
198 | 203 | if raises: |
199 | 204 | with pytest.raises(BadSessionName) as exc_info: |
|
0 commit comments