Beispiel #1
0
 def test_check_encoding_none(self):
     """Cases where the comparison fails."""
     # stream.encoding is None:
     self.assertEqual(io.check_encoding(io.FileInput(), 'ascii'), None)
     # stream.encoding does not exist:
     self.assertEqual(io.check_encoding(BBuf, 'ascii'), None)
     # encoding is None:
     self.assertEqual(io.check_encoding(mock_stdout, None), None)
     # encoding is invalid
     self.assertEqual(io.check_encoding(mock_stdout, 'UTF-9'), None)
Beispiel #2
0
 def test_check_encoding_none(self):
     """Cases where the comparison fails."""
     # stream.encoding is None:
     self.assertEqual(io.check_encoding(io.FileInput(), 'ascii'), None)
     # stream.encoding does not exist:
     self.assertEqual(io.check_encoding(BBuf, 'ascii'), None)
     # encoding is None:
     self.assertEqual(io.check_encoding(mock_stdout, None), None)
     # encoding is invalid
     self.assertEqual(io.check_encoding(mock_stdout, 'UTF-9'), None)
Beispiel #3
0
 def test_check_encoding_false(self):
     """Return `False` if lookup returns different codecs"""
     self.assertEqual(io.check_encoding(mock_stdout, 'ascii'), False)
     self.assertEqual(io.check_encoding(mock_stdout, 'latin-1'), False)
Beispiel #4
0
 def test_check_encoding_true(self):
     """Return `True` if lookup returns the same codec"""
     self.assertEqual(io.check_encoding(mock_stdout, 'utf8'), True)
     self.assertEqual(io.check_encoding(mock_stdout, 'utf-8'), True)
     self.assertEqual(io.check_encoding(mock_stdout, 'UTF-8'), True)
Beispiel #5
0
 def test_check_encoding_false(self):
     """Return `False` if lookup returns different codecs"""
     self.assertEqual(io.check_encoding(mock_stdout, 'ascii'), False)
     self.assertEqual(io.check_encoding(mock_stdout, 'latin-1'), False)
Beispiel #6
0
 def test_check_encoding_true(self):
     """Return `True` if lookup returns the same codec"""
     self.assertEqual(io.check_encoding(mock_stdout, 'utf8'), True)
     self.assertEqual(io.check_encoding(mock_stdout, 'utf-8'), True)
     self.assertEqual(io.check_encoding(mock_stdout, 'UTF-8'), True)