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

Method test_items

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

Source from the content-addressed store, hash-verified

970 assert len(movie_data["movies"].values()) == len(d.movies.values())
971
972 def test_items(self):
973 b = Box()
974 b.foo = {}
975 assert isinstance(list(b.items())[0][1], Box)
976 c = Box()
977 c.foohoo = []
978 assert isinstance(list(c.items())[0][1], BoxList)
979 d = Box(movie_data)
980 assert len(movie_data["movies"].items()) == len(d.movies.items())
981 e = Box(movie_data, box_dots=True)
982 assert sorted(e.items(dotted=True), key=lambda x: x[0]) == sorted(
983 [
984 ("movies.Robin Hood: Men in Tights.Director", "Mel Brooks"),
985 ("movies.Robin Hood: Men in Tights.Stars[0].imdb", "nm0000144"),
986 ("movies.Robin Hood: Men in Tights.Stars[0].name", "Cary Elwes"),
987 ("movies.Robin Hood: Men in Tights.Stars[0].role", "Robin Hood"),
988 ("movies.Robin Hood: Men in Tights.Stars[1].imdb", "nm0507659"),
989 ("movies.Robin Hood: Men in Tights.Stars[1].name", "Richard Lewis"),
990 ("movies.Robin Hood: Men in Tights.Stars[1].role", "Prince John"),
991 ("movies.Robin Hood: Men in Tights.Stars[2].imdb", "nm0715953"),
992 ("movies.Robin Hood: Men in Tights.Stars[2].name", "Roger Rees"),
993 ("movies.Robin Hood: Men in Tights.Stars[2].role", "Sheriff of Rottingham"),
994 ("movies.Robin Hood: Men in Tights.Stars[3].imdb", "nm0001865"),
995 ("movies.Robin Hood: Men in Tights.Stars[3].name", "Amy Yasbeck"),
996 ("movies.Robin Hood: Men in Tights.Stars[3].role", "Marian"),
997 ("movies.Robin Hood: Men in Tights.imdb_stars", 6.7),
998 ("movies.Robin Hood: Men in Tights.length", 104),
999 ("movies.Robin Hood: Men in Tights.rating", "PG-13"),
1000 ("movies.Spaceballs.Director", "Mel Brooks"),
1001 ("movies.Spaceballs.Stars[0].imdb", "nm0000316"),
1002 ("movies.Spaceballs.Stars[0].name", "Mel Brooks"),
1003 ("movies.Spaceballs.Stars[0].role", "President Skroob"),
1004 ("movies.Spaceballs.Stars[1].imdb", "nm0001006"),
1005 ("movies.Spaceballs.Stars[1].name", "John Candy"),
1006 ("movies.Spaceballs.Stars[1].role", "Barf"),
1007 ("movies.Spaceballs.Stars[2].imdb", "nm0001548"),
1008 ("movies.Spaceballs.Stars[2].name", "Rick Moranis"),
1009 ("movies.Spaceballs.Stars[2].role", "Dark Helmet"),
1010 ("movies.Spaceballs.imdb_stars", 7.1),
1011 ("movies.Spaceballs.length", 96),
1012 ("movies.Spaceballs.rating", "PG"),
1013 ],
1014 key=lambda x: x[0],
1015 )
1016 with pytest.raises(BoxError):
1017 Box(box_dots=False).items(dotted=True)
1018
1019 def test_get(self):
1020 bx = Box()

Callers

nothing calls this directly

Calls 3

itemsMethod · 0.95
BoxClass · 0.90
itemsMethod · 0.45

Tested by

no test coverage detected