(a: DataTree, b: DataTree, compat)
| 1157 | |
| 1158 | |
| 1159 | def diff_datatree_repr(a: DataTree, b: DataTree, compat): |
| 1160 | summary = [ |
| 1161 | f"Left and right {type(a).__name__} objects are not {_compat_to_str(compat)}" |
| 1162 | ] |
| 1163 | |
| 1164 | if compat == "identical" and (diff_name := diff_name_summary(a, b)): |
| 1165 | summary.append(diff_name) |
| 1166 | |
| 1167 | treestructure_diff = diff_treestructure(a, b) |
| 1168 | |
| 1169 | # If the trees structures are different there is no point comparing each node, |
| 1170 | # and doing so would raise an error. |
| 1171 | # TODO we could show any differences in nodes up to the first place that structure differs? |
| 1172 | if treestructure_diff is not None: |
| 1173 | summary.append(treestructure_diff) |
| 1174 | elif compat != "isomorphic": |
| 1175 | nodewise_diff = diff_nodewise_summary(a, b, compat) |
| 1176 | summary.append(nodewise_diff) |
| 1177 | |
| 1178 | return "\n\n".join(summary) |
| 1179 | |
| 1180 | |
| 1181 | def inherited_vars(mapping: ChainMap) -> dict: |
no test coverage detected
searching dependent graphs…