def test_ignoreNonWatchedFile(self):
        """
        L{inotify.INotify} will raise KeyError if a non-watched filepath is
        ignored.
        """
        expectedPath = self.dirname.child("foo.ignored")
        expectedPath.touch()

        self.assertRaises(KeyError, self.inotify.ignore, expectedPath)

        L{inotify.INotify} will raise KeyError if a non-watched filepath is
        ignored.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_inotify.py