Esempio n. 1
0
    def test_dig_through_dict(self):
        obj = Entity({
            "a": 1,
            "b": 2,
            "c": Entity({
                "d": 6,
                "e": 7,
            }, None),
        }, None)

        assert obj.dig("a") == 1
        assert obj.dig("c", "d") == 6
Esempio n. 2
0
    def test_dig_for_missing_key(self):
        obj = Entity({
            "a": 1,
            "b": 2,
            "c": Entity({
                "d": 6,
                "e": 7,
            }, None),
        }, None)

        assert obj.dig("k") is None
        assert obj.dig("c", "k") is None