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

Method test_items

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

Source from the content-addressed store, hash-verified

708 assert len(movie_data["movies"].values()) == len(d.movies.values())
709
710 def test_items(self):
711 b = Box()
712 b.foo = {}
713 assert isinstance(list(b.items())[0][1], Box)
714 c = Box()
715 c.foohoo = []
716 assert isinstance(list(c.items())[0][1], BoxList)
717 d = Box(movie_data)
718 assert len(movie_data["movies"].items()) == len(d.movies.items())
719 e = Box(movie_data, box_dots=True)
720 assert sorted(e.items(dotted=True), key=lambda x: x[0]) == sorted(
721 [
722 ("movies.Robin Hood: Men in Tights.Director", "Mel Brooks"),
723 ("movies.Robin Hood: Men in Tights.Stars[0].imdb", "nm0000144"),
724 ("movies.Robin Hood: Men in Tights.Stars[0].name", "Cary Elwes"),
725 ("movies.Robin Hood: Men in Tights.Stars[0].role", "Robin Hood"),
726 ("movies.Robin Hood: Men in Tights.Stars[1].imdb", "nm0507659"),
727 ("movies.Robin Hood: Men in Tights.Stars[1].name", "Richard Lewis"),
728 ("movies.Robin Hood: Men in Tights.Stars[1].role", "Prince John"),
729 ("movies.Robin Hood: Men in Tights.Stars[2].imdb", "nm0715953"),
730 ("movies.Robin Hood: Men in Tights.Stars[2].name", "Roger Rees"),
731 ("movies.Robin Hood: Men in Tights.Stars[2].role", "Sheriff of Rottingham"),
732 ("movies.Robin Hood: Men in Tights.Stars[3].imdb", "nm0001865"),
733 ("movies.Robin Hood: Men in Tights.Stars[3].name", "Amy Yasbeck"),
734 ("movies.Robin Hood: Men in Tights.Stars[3].role", "Marian"),
735 ("movies.Robin Hood: Men in Tights.imdb_stars", 6.7),
736 ("movies.Robin Hood: Men in Tights.length", 104),
737 ("movies.Robin Hood: Men in Tights.rating", "PG-13"),
738 ("movies.Spaceballs.Director", "Mel Brooks"),
739 ("movies.Spaceballs.Stars[0].imdb", "nm0000316"),
740 ("movies.Spaceballs.Stars[0].name", "Mel Brooks"),
741 ("movies.Spaceballs.Stars[0].role", "President Skroob"),
742 ("movies.Spaceballs.Stars[1].imdb", "nm0001006"),
743 ("movies.Spaceballs.Stars[1].name", "John Candy"),
744 ("movies.Spaceballs.Stars[1].role", "Barf"),
745 ("movies.Spaceballs.Stars[2].imdb", "nm0001548"),
746 ("movies.Spaceballs.Stars[2].name", "Rick Moranis"),
747 ("movies.Spaceballs.Stars[2].role", "Dark Helmet"),
748 ("movies.Spaceballs.imdb_stars", 7.1),
749 ("movies.Spaceballs.length", 96),
750 ("movies.Spaceballs.rating", "PG"),
751 ],
752 key=lambda x: x[0],
753 )
754 with pytest.raises(BoxError):
755 Box(box_dots=False).items(dotted=True)
756
757 def test_get(self):
758 bx = Box()

Callers

nothing calls this directly

Calls 2

itemsMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected