Exemplo n.º 1
0
def test_add_label_columns():
    table = Table(
        Pod,
        {
            "kind": "Table",
            "columnDefinitions": [],
            "rows": [{
                "cells": [],
                "object": {
                    "metadata": {}
                }
            }],
        },
    )
    add_label_columns(table, "foo, bar")
    assert table.columns == [
        {
            "name": "Foo",
            "description": "foo label",
            "label": "foo"
        },
        {
            "name": "Bar",
            "description": "bar label",
            "label": "bar"
        },
    ]
Exemplo n.º 2
0
 def _add_label_cols():
     table = Table(
         Pod,
         {
             "kind":
             "Table",
             "columnDefinitions": [{
                 "name": "A"
             }, {
                 "name": "C"
             }, {
                 "name": "E"
             }],
             "rows": [{
                 "cells": ["a", "c", "e"],
                 "object": {
                     "metadata": {
                         "labels": {
                             "foo": "bar"
                         }
                     }
                 },
             }] * 100,
             "clusters": ["c1"],
         },
     )
     add_label_columns(table, "*")
Exemplo n.º 3
0
def test_add_label_columns_all():
    table = Table(
        Pod,
        {
            "kind": "Table",
            "columnDefinitions": [],
            "rows": [{"cells": [], "object": {"metadata": {}}}],
        },
    )
    add_label_columns(table, "*")
    assert table.columns == [{"name": "Labels", "description": "* label", "label": "*"}]
Exemplo n.º 4
0
def test_add_label_columns():
    table = Table(Pod, {"kind": "Table", "columnDefinitions": [], "rows": []})
    add_label_columns(table, "foo, bar")
    assert table.columns == [
        {
            "name": "Foo",
            "description": "foo label"
        },
        {
            "name": "Bar",
            "description": "bar label"
        },
    ]
Exemplo n.º 5
0
def test_add_label_columns_empty():
    table = Table(Pod, {"kind": "Table", "columnDefinitions": [], "rows": []})
    add_label_columns(table, ", ")
    assert table.columns == []