Mercurial > hgrepos > Python > libs > data-schema
diff data_schema/__init__.py @ 30:2e7c08c356ee
Test the the ValidationProblem's str() and repr()
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 08 Jul 2023 20:45:36 +0200 |
| parents | 68286d27f27d |
| children | 271ec3abdfa3 |
line wrap: on
line diff
--- a/data_schema/__init__.py Sat Jul 08 16:10:36 2023 +0200 +++ b/data_schema/__init__.py Sat Jul 08 20:45:36 2023 +0200 @@ -221,12 +221,16 @@ msg = " (" + problem_message(self) + ")" except LookupError: msg = "" + if self.context is not None: + context_depth = self.context.depth + else: + context_depth = None if self.index is None: return "ValidationProblem(code={}{}, severity={}, hint={}, context=[depth={}]{})".format( - self.code.name, msg, self.severity.name, self.hint, self.context.depth, self.context) + self.code.name, msg, self.severity.name, self.hint, context_depth, self.context) else: return "ValidationProblem(code={}{}, severity={}, hint={}, context=[depth={}]{}, index={})".format( - self.code.name, msg, self.severity.name, self.hint, self.context.depth, self.context, self.index) + self.code.name, msg, self.severity.name, self.hint, context_depth, self.context, self.index) class SchemaError(Exception):
