def test_nonString(self):
        """
        L{networkString} raises L{TypeError} if passed a non-string object or
        the wrong type of string object.
        """
        self.assertRaises(TypeError, networkString, object())
        if _PY3:
            self.assertRaises(TypeError, networkString, b"bytes")
        else:
            self.assertRaises(TypeError, networkString, u"text")

        L{networkString} raises L{TypeError} if passed a non-string object or
        the wrong type of string object.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_compat.py