MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_dots

Method test_dots

test/test_box.py:919–946  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

917 assert bl == [["foo"]], bl
918
919 def test_dots(self):
920 b = Box(movie_data.copy(), box_dots=True)
921 assert b["movies.Spaceballs.rating"] == "PG"
922 b["movies.Spaceballs.rating"] = 4
923 assert b["movies.Spaceballs.rating"] == 4
924 del b["movies.Spaceballs.rating"]
925 with pytest.raises(BoxKeyError):
926 b["movies.Spaceballs.rating"]
927 assert b["movies.Spaceballs.Stars[1].role"] == "Barf"
928 b["movies.Spaceballs.Stars[1].role"] = "Testing"
929 assert b["movies.Spaceballs.Stars[1].role"] == "Testing"
930 assert b.movies.Spaceballs.Stars[1].role == "Testing"
931 with pytest.raises(BoxError):
932 b["."]
933 with pytest.raises(BoxError):
934 from box.box import _parse_box_dots
935
936 _parse_box_dots({}, "-")
937
938 with pytest.raises(KeyError):
939 b["a.b"]
940 with pytest.raises(BoxKeyError):
941 b["a.b"]
942
943 with pytest.raises(KeyError):
944 del b["a.b"]
945 with pytest.raises(BoxKeyError):
946 del b["a.b"]
947
948 def test_dots_exclusion(self):
949 bx = Box.from_yaml(

Callers

nothing calls this directly

Calls 3

BoxClass · 0.90
_parse_box_dotsFunction · 0.90
copyMethod · 0.45

Tested by

no test coverage detected