def test_staticChildPathType(self):
        """
        Test that passing the wrong type to putChild results in a warning,
        and a failure in Python 3
        """
        resource = Resource()
        child = Resource()
        sibling = Resource()
        resource.putChild(u"foo", child)
        warnings = self.flushWarnings([self.test_staticChildPathType])
        self.assertEqual(len(warnings), 1)
        self.assertIn("Path segment must be bytes",
                      warnings[0]['message'])
        if _PY3:
            # We expect an error here because u"foo" != b"foo" on Py3k
            self.assertIsInstance(
                resource.getChildWithDefault(b"foo", DummyRequest([])),
                ErrorPage)

        resource.putChild(None, sibling)
        warnings = self.flushWarnings([self.test_staticChildPathType])
        self.assertEqual(len(warnings), 1)
        self.assertIn("Path segment must be bytes",
                      warnings[0]['message'])

        Test that passing the wrong type to putChild results in a warning,
        and a failure in Python 3
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_resource.py