def _filter_table(): table = Table( Pod, { "kind": "Table", "columnDefinitions": [{"name": "A"}, {"name": "C"}, {"name": "E"}], "rows": [{"cells": ["a", "c", "e"]}] * 100, "clusters": ["c1"], }, ) filter_table(table, "c")
def test_filter_table_text_match_case_insensitive2(single_pod_table): table = single_pod_table filter_table(table, "backoff") assert len(table.rows) == 1
def test_filter_table_text_match(single_pod_table): table = single_pod_table filter_table(table, "myname") assert len(table.rows) == 1
def test_filter_table_whitespace_ignore(single_pod_table): table = single_pod_table filter_table(table, " Name = myname ") assert len(table.rows) == 1
def test_filter_table_column_match(single_pod_table): table = single_pod_table filter_table(table, "Name=myname") assert len(table.rows) == 1
def test_filter_table_no_match(single_pod_table): table = single_pod_table filter_table(table, "Name=b") assert len(table.rows) == 0
def test_filter_table_wrong_column_name(single_pod_table): table = single_pod_table filter_table(table, "a=b") assert len(table.rows) == 0
def test_filter_table_not_equal(two_pod_table): table = two_pod_table filter_table(table, "Name!=pod-a") assert len(table.rows) == 1 assert table.rows[0]["cells"][0] == "pod-b"
def test_filter_table_not_equal_and(two_pod_table): table = two_pod_table filter_table(table, "Status!=Running,Status!=Completed") assert len(table.rows) == 0
def test_filter_table_text_no_match_multi(single_pod_table): table = single_pod_table # "my" matches first column, but "xxx" does not match filter_table(table, "my, xxx") assert len(table.rows) == 0
def test_filter_table_text_match_multi(single_pod_table): table = single_pod_table # letters "m" and "a" are in both cells filter_table(table, "m, a") assert len(table.rows) == 1
def test_filter_table_text_match_label2(single_pod_table_with_labels): table = single_pod_table_with_labels filter_table(table, "labelval1", match_labels=True) assert len(table.rows) == 1
def test_filter_table_empty(single_pod_table): table = single_pod_table filter_table(table, "") assert len(table.rows) == 1