harness.check(type1.nullable(), False, "attr1 should not be nullable")
harness.check(type2.nullable(), True, "attr2 should be nullable")
# We don't know about type1, but type2, the nullable type, definitely # shouldn't be builtin.
harness.check(type2.builtin, False, "attr2 should not be builtin")
# Ensure that all attributes of type2 match those in type1, except for: # - names on an ignore list, # - names beginning with '_', # - functions which throw when called with no args, and # - class-level non-callables ("static variables"). # # Yes, this is an ugly, fragile hack. But it finds bugs... for attr in dir(type1): if (
attr.startswith("_") or attr in [ "nullable", "builtin", "filename", "location", "inner", "QName", "getDeps", "name", "prettyName",
] or (hasattr(type(type1), attr) andnot callable(getattr(type1, attr)))
): continue
a1 = getattr(type1, attr)
if callable(a1): try:
v1 = a1() except AssertionError: # Various methods assert that they're called on objects of # the right type, skip them if the assert fails. continue except TypeError: # a1 requires positional arguments, so skip this attribute. continue
try:
a2 = getattr(type2, attr) except WebIDL.WebIDLError:
harness.ok( False, "Missing %s attribute on type %s in %s" % (attr, type2, iface),
) continue
ifnot callable(a2):
harness.ok( False, "%s attribute on type %s in %s wasn't callable"
% (attr, type2, iface),
) continue
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.