diff --git a/tests/data.py b/tests/data.py index c904e8f..4503c05 100755 --- a/tests/data.py +++ b/tests/data.py @@ -2808,3 +2808,34 @@ data_stream_layout_kwargs = [ ["A.O.P Cornas", ""], ["Domaine Lionnet « Terre Brûlée » 2012", "15 €"], ] + +data_stream_vertical_headers = [ + ['', 'Number of Registered voters', 'Poll Book Totals', 'Brian Calley', 'Patrick Colbeck', 'Jim Hines', 'Bill Schuette', 'John James', 'Sandy Pensler', '', 'Jack Bergman', '', + 'Jim Stamas', 'Sue Allor', 'Melissa A. Cordes', '', 'Al Scully', '', 'Daniel G. Gauthier', 'Craig M. Clemens', 'Craig Johnston', 'Carolyn Brummund', 'Adam Brege', 'David Bielusiak', ''], + ['Alcona', '963', '439', '55', '26', '47', '164', '173', '111', '', '268', + '', '272', '275', '269', '', '271', '', '224', '76', '', '', '', '', ''], + ['Caledonia', '923', '393', '40', '23', '45', '158', '150', '103', '', '244', + '', '247', '254', '255', '', '244', '', '139', '143', '', '', '', '', ''], + ['Curtis', '1026', '349', '30', '30', '25', '102', '95', '84', '', '159', + '', '164', '162', '161', '', '157', '', '', '', '', '', '', '', ''], + ['Greenbush', '1212', '423', '56', '26', '40', '126', '104', '131', '', '208', + '', '213', '214', '215', '', '208', '', '', '', '', '208', '', '', ''], + ['Gustin', '611', '180', '22', '35', '17', '55', '73', '45', '', '108', + '', '104', '111', '111', '', '109', '', '', '', '', '', '81', '42', ''], + ['Harrisville', '1142', '430', '45', '90', '29', '101', '155', '94', '', '226', + '', '226', '232', '244', '', '226', '', '', '', '232', '', '', '', ''], + ['Hawes', '884', '293', '38', '36', '27', '109', '121', '84', '', '192', + '', '195', '195', '193', '', '184', '', '', '', '', '', '118', '87', ''], + ['Haynes', '626', '275', '31', '20', '32', '104', '121', '53', '', '163', + '', '163', '173', '161', '', '152', '', '', '', '76', '', '69', '31', ''], + ['Mikado', '781', '208', '19', '39', '17', '81', '90', '63', '', '149', + '', '149', '145', '147', '', '143', '', '', '', '', '113', '', '', ''], + ['Millen', '353', '139', '7', '16', '13', '38', '49', '19', '', '62', + '', '66', '67', '66', '', '62', '', '', '', '', '', '', '', ''], + ['Mitchell', '327', '96', '12', '17', '7', '29', '41', '17', '', '57', + '', '55', '57', '60', '', '56', '', '', '', '', '', '', '', ''], + ['City Harrisville', '389', '171', '16', '15', '18', '35', '49', '31', '', + '78', '', '80', '82', '81', '', '77', '', '', '', '73', '', '', '', ''], + ['Totals', '9237', '3396', '371', '373', '317', '1102', '1221', '835', '0', '1914', '0', + '1934', '1967', '1963', '0', '1889', '0', '363', '219', '381', '321', '268', '160', '0'] +] diff --git a/tests/files/vertical_header.pdf b/tests/files/vertical_header.pdf new file mode 100644 index 0000000..a343305 Binary files /dev/null and b/tests/files/vertical_header.pdf differ diff --git a/tests/test_common.py b/tests/test_common.py index 6fadc9d..f8d158e 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -143,6 +143,14 @@ def test_stream_layout_kwargs(): assert_frame_equal(df, tables[0].df) +def test_stream_vertical_header(): + df = pd.DataFrame(data_stream_vertical_headers) + + filename = os.path.join(testdir, "vertical_header.pdf") + tables = camelot.read_pdf(filename, flavor="stream") + assert_frame_equal(df, tables[0].df) + + def test_lattice(): df = pd.DataFrame(data_lattice)