Ejemplo n.º 1
0
def test_guess_encoding_iso8859():
    assert File.guess_encoding(TEST_ISO8859_PATH) == 'iso-8859-1'
Ejemplo n.º 2
0
 def encoding(self):
     if not hasattr(self, "_encoding"):
         self._encoding = File.guess_encoding(self.path)
     return self._encoding
Ejemplo n.º 3
0
def test_guess_encoding_ascii():
    assert File.guess_encoding(TEST_ASCII_PATH) == 'us-ascii'
Ejemplo n.º 4
0
def test_guess_encoding_unicode():
    assert File.guess_encoding(TEST_UNICODE_PATH) == 'utf-8'
Ejemplo n.º 5
0
def test_guess_file_type():
    assert File.guess_file_type(TEST_FILE1_PATH) == 'data'
Ejemplo n.º 6
0
def test_guess_encoding_binary():
    assert File.guess_encoding(TEST_FILE1_PATH) == 'binary'
Ejemplo n.º 7
0
def test_guess_encoding_iso8859():
    assert File.guess_encoding(TEST_ISO8859_PATH) == 'iso-8859-1'
Ejemplo n.º 8
0
 def encoding(self):
     if not hasattr(self, '_encoding'):
         self._encoding = File.guess_encoding(self.path)
     return self._encoding
Ejemplo n.º 9
0
def test_guess_encoding_unicode():
    assert File.guess_encoding(TEST_UNICODE_PATH) == 'utf-8'
Ejemplo n.º 10
0
def test_guess_encoding_ascii():
    assert File.guess_encoding(TEST_ASCII_PATH) == 'us-ascii'
Ejemplo n.º 11
0
def test_guess_encoding_binary():
    assert File.guess_encoding(TEST_FILE1_PATH) == 'binary'
Ejemplo n.º 12
0
def test_guess_file_type():
    assert File.guess_file_type(TEST_FILE1_PATH) == 'data'
Ejemplo n.º 13
0
 def encoding(self):
     if not hasattr(self, '_encoding'):
         with self.get_content():
             self._encoding = File.guess_encoding(self.path)
     return self._encoding