allow strings or functions for tab filter function in python module
This commit is contained in:
@@ -238,6 +238,17 @@ class TestTabs:
|
||||
mock_send.return_value = None
|
||||
assert b.tabs_filter("x") == []
|
||||
|
||||
def test_tabs_filter_predicate(self, b, mock_send):
|
||||
mock_send.return_value = [TAB_DATA, {**TAB_DATA, "id": 11, "url": "https://youtube.com"}]
|
||||
tabs = b.tabs_filter(lambda tab: "youtube" in tab.url)
|
||||
print(tabs)
|
||||
assert [tab.id for tab in tabs] == [11]
|
||||
|
||||
def test_tabs_filter_list_transformer(self, b, mock_send):
|
||||
mock_send.return_value = [TAB_DATA, {**TAB_DATA, "id": 11, "url": "https://example.com"}]
|
||||
tabs = b.tabs_filter(lambda tabs: tabs[:1])
|
||||
assert [tab.id for tab in tabs] == [10]
|
||||
|
||||
def test_tabs_count(self, b, mock_send):
|
||||
mock_send.return_value = 5
|
||||
assert b.tabs_count() == 5
|
||||
|
||||
Reference in New Issue
Block a user