diff options
author | Jonas Schäfer <j.wielicki@sotecware.net> | 2020-05-10 14:38:43 +0200 |
---|---|---|
committer | Jonas Schäfer <j.wielicki@sotecware.net> | 2020-05-12 22:26:51 +0200 |
commit | c1863addfd33d3d3f3f03bcb036a0966097914cb (patch) | |
tree | d62d28e9b396b1d65a64e00ed5628e4c21493f64 /test | |
parent | d4d0c1a19f5fc5df0f082df1fb7323141175a310 (diff) | |
download | poezio-c1863addfd33d3d3f3f03bcb036a0966097914cb.tar.gz poezio-c1863addfd33d3d3f3f03bcb036a0966097914cb.tar.bz2 poezio-c1863addfd33d3d3f3f03bcb036a0966097914cb.tar.xz poezio-c1863addfd33d3d3f3f03bcb036a0966097914cb.zip |
Add function to find a tab by unique prefix
Diffstat (limited to 'test')
-rw-r--r-- | test/test_tabs.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_tabs.py b/test/test_tabs.py index 0a6930d4..6989bd67 100644 --- a/test/test_tabs.py +++ b/test/test_tabs.py @@ -183,3 +183,25 @@ def test_slice(): tabs.append(dummy3) assert tabs[1:2][0] is dummy2 + +def test_find_by_unique_prefix(): + DummyTab.reset() + tabs = Tabs(h) + t1 = DummyTab() + t2 = DummyTab() + t3 = DummyTab() + tabs.append(t1) + tabs.append(t2) + tabs.append(t3) + + t1.name = "foo" + t2.name = "bar" + t3.name = "fnord" + + assert tabs.find_by_unique_prefix("f") == (True, None) + assert tabs.find_by_unique_prefix("b") == (True, t2) + assert tabs.find_by_unique_prefix("fo") == (True, t1) + assert tabs.find_by_unique_prefix("fn") == (True, t3) + assert tabs.find_by_unique_prefix("fx") == (False, None) + assert tabs.find_by_unique_prefix("x") == (False, None) + assert tabs.find_by_unique_prefix("") == (True, None) |