(meta, name, bases, class_dict)
| 190 | |
| 191 | class ValidateFilledPolygon(ValidatePolygon): |
| 192 | def __new__(meta, name, bases, class_dict): |
| 193 | # Only validate non-root classes |
| 194 | if not class_dict.get("is_root"): |
| 195 | if class_dict["color"] not in ("red", "green"): |
| 196 | raise ValueError("Fill color must be supported") |
| 197 | return super().__new__(meta, name, bases, class_dict) |
| 198 | |
| 199 | class FilledPolygon(Polygon, metaclass=ValidateFilledPolygon): |
| 200 | is_root = True |