MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_2979

Function test_2979

tests/test_tables.py:164–193  ·  view source on GitHub ↗

This tests fix #2979 and #3001. 2979: identical cell count for each row 3001: no change of global glyph heights

()

Source from the content-addressed store, hash-verified

162
163
164def test_2979():
165 """This tests fix #2979 and #3001.
166
167 2979: identical cell count for each row
168 3001: no change of global glyph heights
169 """
170 filename = os.path.join(scriptdir, "resources", "test_2979.pdf")
171 doc = pymupdf.open(filename)
172 page = doc[0]
173 tab = page.find_tables()[0] # extract the table
174 lengths = set() # stores all row cell counts
175 for e in tab.extract():
176 lengths.add(len(e)) # store number of cells for row
177
178 # test 2979
179 assert len(lengths) == 1
180
181 # test 3001
182 assert (
183 pymupdf.TOOLS.set_small_glyph_heights() is False
184 ), f"{pymupdf.TOOLS.set_small_glyph_heights()=}"
185
186 wt = pymupdf.TOOLS.mupdf_warnings()
187 if pymupdf.mupdf_version_tuple >= (1, 28, 0):
188 assert ( wt == '' )
189 else:
190 assert (
191 wt
192 == "bogus font ascent/descent values (3117 / -2463)\n... repeated 2 times..."
193 )
194
195
196def test_3062():

Callers

nothing calls this directly

Calls 4

extractMethod · 0.80
mupdf_warningsMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…