[Lldb-commits] [PATCH] D88792: [lldb/test] Catch invalid calls to expect()

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 5 10:05:14 PDT 2020


kastiglione added inline comments.


================
Comment at: lldb/packages/Python/lldbsuite/test/lldbtest.py:2440-2441
+            assert "patterns must be a collection of strings" and False
+        if isinstance(substrs, six.string_types):
+            assert "substrs must be a collection of strings" and False
+
----------------
teemperor wrote:
> labath wrote:
> > `assert isinstance(substrs, six.string_types), "substrs must be a collection of strings"` ?
> Or we could do `assertNotIsInstance` for a better error message that should show the actual type.
It turns out that in practice `assertNotIsInstance` isn't a good match for this case because `six.string_types` is a tuple, and the formatted string becomes `"… is an instance of (<class 'str'>,)"`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88792/new/

https://reviews.llvm.org/D88792



More information about the lldb-commits mailing list