def test_dumps(self):
        contents = {
            "CLASSIFICATION": {"category": "cat", "attributes": {"gender": "male"}},
            "BOX2D": [
                {
                    "box2d": {"xmin": 1, "ymin": 1, "xmax": 2, "ymax": 2},
                    "category": "dog",
                    "attributes": {"gender": "female"},
                }
            ],
        }

        label = Label()
        label.classification = Classification.loads(contents["CLASSIFICATION"])
        label.box2d = [LabeledBox2D.loads(contents["BOX2D"][0])]
        assert label.dumps() == contents
    def test_loads(self):
        contents = {
            "box2d": {
                "xmin": 1,
                "ymin": 2,
                "xmax": 5,
                "ymax": 8
            },
            "category": "cat",
            "attributes": {
                "gender": "male"
            },
            "instance": 12345,
        }
        labeledbox2d = LabeledBox2D.loads(contents)

        assert labeledbox2d.category == "cat"
        assert labeledbox2d.attributes == {"gender": "male"}
        assert labeledbox2d.instance == 12345

        assert labeledbox2d[0] == 1
        assert labeledbox2d[1] == 2
        assert labeledbox2d[2] == 5
        assert labeledbox2d[3] == 8