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

Method test_dots

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

Source from the content-addressed store, hash-verified

1180 assert bl == [["foo"]], bl
1181
1182 def test_dots(self):
1183 b = Box(movie_data.copy(), box_dots=True)
1184 assert b["movies.Spaceballs.rating"] == "PG"
1185 b["movies.Spaceballs.rating"] = 4
1186 assert b["movies.Spaceballs.rating"] == 4
1187 del b["movies.Spaceballs.rating"]
1188 with pytest.raises(BoxKeyError):
1189 b["movies.Spaceballs.rating"]
1190 assert b["movies.Spaceballs.Stars[1].role"] == "Barf"
1191 b["movies.Spaceballs.Stars[1].role"] = "Testing"
1192 assert b["movies.Spaceballs.Stars[1].role"] == "Testing"
1193 assert b.movies.Spaceballs.Stars[1].role == "Testing"
1194 with pytest.raises(BoxError):
1195 b["."]
1196 with pytest.raises(BoxError):
1197 from box.box import _parse_box_dots
1198
1199 _parse_box_dots({}, "-")
1200
1201 with pytest.raises(KeyError):
1202 b["a.b"]
1203 with pytest.raises(BoxKeyError):
1204 b["a.b"]
1205
1206 with pytest.raises(KeyError):
1207 del b["a.b"]
1208 with pytest.raises(BoxKeyError):
1209 del b["a.b"]
1210
1211 def test_dots_exclusion(self):
1212 bx = Box.from_yaml(

Callers

nothing calls this directly

Calls 3

BoxClass · 0.90
_parse_box_dotsFunction · 0.90
copyMethod · 0.80

Tested by

no test coverage detected