def test_detect_encoding_with_bad_encoding(self): with temporary_file('# -*- coding: blah -*-\n') as filename: self.assertEqual('latin-1', docformatter.detect_encoding(filename))