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

Method test_dots

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

Source from the content-addressed store, hash-verified

1245 assert bl == [["foo"]], bl
1246
1247 def test_dots(self):
1248 b = Box(movie_data.copy(), box_dots=True)
1249 assert b["movies.Spaceballs.rating"] == "PG"
1250 b["movies.Spaceballs.rating"] = 4
1251 assert b["movies.Spaceballs.rating"] == 4
1252 del b["movies.Spaceballs.rating"]
1253 with pytest.raises(BoxKeyError):
1254 b["movies.Spaceballs.rating"]
1255 assert b["movies.Spaceballs.Stars[1].role"] == "Barf"
1256 b["movies.Spaceballs.Stars[1].role"] = "Testing"
1257 assert b["movies.Spaceballs.Stars[1].role"] == "Testing"
1258 assert b.movies.Spaceballs.Stars[1].role == "Testing"
1259 with pytest.raises(BoxError):
1260 b["."]
1261 with pytest.raises(BoxError):
1262 from box.box import _parse_box_dots
1263
1264 _parse_box_dots({}, "-")
1265
1266 with pytest.raises(KeyError):
1267 b["a.b"]
1268 with pytest.raises(BoxKeyError):
1269 b["a.b"]
1270
1271 with pytest.raises(KeyError):
1272 del b["a.b"]
1273 with pytest.raises(BoxKeyError):
1274 del b["a.b"]
1275
1276 def test_dots_exclusion(self):
1277 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