def check(self, d):
for key in self.trait_names():<EOL><INDENT>yield nt.assert_true(key in d, "<STR_LIT>" % (key, d))<EOL>if d[key] is None:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>setattr(self, key, d[key])<EOL><DEDENT>except TraitError as e:<EOL><INDENT>yield nt.assert_true(False, str(e))<EOL><DEDENT><DEDENT>
validate a dict against our traits