Beispiel #1
0
def test_get_encoding_with_invalid_differences():
    """Invalid differences should be silently ignored

    Regression test for https://github.com/pdfminer/pdfminer.six/issues/385
    """
    invalid_differences = [PSLiteral('ubuntu'), PSLiteral('1234')]
    EncodingDB.get_encoding('StandardEncoding', invalid_differences)
def test_get_cmap_from_pickle():
    """Test if cmap file is read from pdfminer/cmap

    Regression test for https://github.com/pdfminer/pdfminer.six/issues/391
    """
    cmap_name = 'UniGB-UCS2-H'
    spec = {'Encoding': PSLiteral(cmap_name)}
    resource_manager = PDFResourceManager()
    font = PDFCIDFont(resource_manager, spec)

    cmap = font.get_cmap_from_spec(spec, False)

    assert_equal(cmap.attrs.get('CMapName'), cmap_name)
    assert_greater(len(cmap.code2cid), 0)
 def test_decode_psl_list(self):
     a = [PSLiteral("test"), "test_2"]
     assert utils.decode_psl_list(a) == ["test", "test_2"]
 def test_encoding_DLIdentH_as_PSLiteral_stream(self):
     stream = PDFStream({'CMapName':PSLiteral('DLIdent-V')}, '')
     spec = {'Encoding': stream}
     font = PDFCIDFont(None, spec)
     assert isinstance(font.cmap, IdentityCMap)
 def test_encoding_DLIdentV(self):
     spec = {'Encoding': PSLiteral('DLIdent-V')}
     font = PDFCIDFont(None, spec)
     assert isinstance(font.cmap, IdentityCMap)
 def test_cmapname_H(self):
     stream = PDFStream({'CMapName': PSLiteral('H')}, '')
     spec = {'Encoding': stream}
     font = PDFCIDFont(None, spec)
     assert isinstance(font.cmap, CMap)
 def test_cmapname_onebyteidentityH(self):
     stream = PDFStream({'CMapName': PSLiteral('OneByteIdentityH')}, '')
     spec = {'Encoding': stream}
     font = PDFCIDFont(None, spec)
     assert isinstance(font.cmap, IdentityCMapByte)