(self, key, value)
| 873 | del self._properties[key] |
| 874 | |
| 875 | def AppendProperty(self, key, value): |
| 876 | # TODO(mark): Support ExtendProperty too (and make this call that)? |
| 877 | |
| 878 | # Schema validation. |
| 879 | if key not in self._schema: |
| 880 | raise KeyError(key + " not in " + self.__class__.__name__) |
| 881 | |
| 882 | (is_list, property_type, is_strong) = self._schema[key][0:3] |
| 883 | if not is_list: |
| 884 | raise TypeError(key + " of " + self.__class__.__name__ + " must be list") |
| 885 | if not isinstance(value, property_type): |
| 886 | raise TypeError( |
| 887 | "item of " |
| 888 | + key |
| 889 | + " of " |
| 890 | + self.__class__.__name__ |
| 891 | + " must be " |
| 892 | + property_type.__name__ |
| 893 | + ", not " |
| 894 | + value.__class__.__name__ |
| 895 | ) |
| 896 | |
| 897 | # If the property doesn't exist yet, create a new empty list to receive the |
| 898 | # item. |
| 899 | self._properties[key] = self._properties.get(key, []) |
| 900 | |
| 901 | # Set up the ownership link. |
| 902 | if is_strong: |
| 903 | value.parent = self |
| 904 | |
| 905 | # Store the item. |
| 906 | self._properties[key].append(value) |
| 907 | |
| 908 | def VerifyHasRequiredProperties(self): |
| 909 | """Ensure that all properties identified as required by the schema are |
no test coverage detected