def METHOD_NAME(self):
    with util.mock_spec('pkg.__init__') as importer:
        with util.import_state(meta_path=[importer]), \
             warnings.catch_warnings():
            warnings.simplefilter('error', BytesWarning)
            with self.assertRaisesRegex(TypeError, r'\bfrom\b'):
                self.__import__('pkg', fromlist=[b'attr'])
            with self.assertRaisesRegex(TypeError, r'\bfrom\b'):
                self.__import__('pkg', fromlist=iter([b'attr']))