aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/traitlets/py3/tests/utils/test_bunch.py
blob: 90efe982739c3aece35de290ce85742fb0417d1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from __future__ import annotations

from traitlets.utils.bunch import Bunch


def test_bunch():
    b = Bunch(x=5, y=10)
    assert "y" in b
    assert "x" in b
    assert b.x == 5
    b["a"] = "hi"
    assert b.a == "hi"


def test_bunch_dir():
    b = Bunch(x=5, y=10)
    assert "x" in dir(b)
    assert "keys" in dir(b)