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

Method test_items

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

Source from the content-addressed store, hash-verified

1019 assert len(movie_data["movies"].values()) == len(d.movies.values())
1020
1021 def test_items(self):
1022 b = Box()
1023 b.foo = {}
1024 assert isinstance(list(b.items())[0][1], Box)
1025 c = Box()
1026 c.foohoo = []
1027 assert isinstance(list(c.items())[0][1], BoxList)
1028 d = Box(movie_data)
1029 assert len(movie_data["movies"].items()) == len(d.movies.items())
1030 e = Box(movie_data, box_dots=True)
1031 assert sorted(e.items(dotted=True), key=lambda x: x[0]) == sorted(
1032 [
1033 ("movies.Robin Hood: Men in Tights.Director", "Mel Brooks"),
1034 ("movies.Robin Hood: Men in Tights.Stars[0].imdb", "nm0000144"),
1035 ("movies.Robin Hood: Men in Tights.Stars[0].name", "Cary Elwes"),
1036 ("movies.Robin Hood: Men in Tights.Stars[0].role", "Robin Hood"),
1037 ("movies.Robin Hood: Men in Tights.Stars[1].imdb", "nm0507659"),
1038 ("movies.Robin Hood: Men in Tights.Stars[1].name", "Richard Lewis"),
1039 ("movies.Robin Hood: Men in Tights.Stars[1].role", "Prince John"),
1040 ("movies.Robin Hood: Men in Tights.Stars[2].imdb", "nm0715953"),
1041 ("movies.Robin Hood: Men in Tights.Stars[2].name", "Roger Rees"),
1042 ("movies.Robin Hood: Men in Tights.Stars[2].role", "Sheriff of Rottingham"),
1043 ("movies.Robin Hood: Men in Tights.Stars[3].imdb", "nm0001865"),
1044 ("movies.Robin Hood: Men in Tights.Stars[3].name", "Amy Yasbeck"),
1045 ("movies.Robin Hood: Men in Tights.Stars[3].role", "Marian"),
1046 ("movies.Robin Hood: Men in Tights.imdb_stars", 6.7),
1047 ("movies.Robin Hood: Men in Tights.length", 104),
1048 ("movies.Robin Hood: Men in Tights.rating", "PG-13"),
1049 ("movies.Spaceballs.Director", "Mel Brooks"),
1050 ("movies.Spaceballs.Stars[0].imdb", "nm0000316"),
1051 ("movies.Spaceballs.Stars[0].name", "Mel Brooks"),
1052 ("movies.Spaceballs.Stars[0].role", "President Skroob"),
1053 ("movies.Spaceballs.Stars[1].imdb", "nm0001006"),
1054 ("movies.Spaceballs.Stars[1].name", "John Candy"),
1055 ("movies.Spaceballs.Stars[1].role", "Barf"),
1056 ("movies.Spaceballs.Stars[2].imdb", "nm0001548"),
1057 ("movies.Spaceballs.Stars[2].name", "Rick Moranis"),
1058 ("movies.Spaceballs.Stars[2].role", "Dark Helmet"),
1059 ("movies.Spaceballs.imdb_stars", 7.1),
1060 ("movies.Spaceballs.length", 96),
1061 ("movies.Spaceballs.rating", "PG"),
1062 ],
1063 key=lambda x: x[0],
1064 )
1065 with pytest.raises(BoxError):
1066 Box(box_dots=False).items(dotted=True)
1067
1068 def test_get(self):
1069 bx = Box()

Callers

nothing calls this directly

Calls 3

itemsMethod · 0.95
BoxClass · 0.90
itemsMethod · 0.45

Tested by

no test coverage detected