summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJames R. Barlow <jim@purplerock.ca>2018-07-14 02:06:54 -0700
committerJames R. Barlow <jim@purplerock.ca>2018-07-14 02:14:20 -0700
commit082f3fee1311bdcd592bd6fffb53ad86e05d687f (patch)
tree1c49c114d8f3323c52e499d57a63ff4545296ac2 /tests
parent22de76f867755402012628c9c695e84d70191f3a (diff)
Reorganize IPython helpers add them to test suite
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ipython.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_ipython.py b/tests/test_ipython.py
new file mode 100644
index 0000000..4f616c8
--- /dev/null
+++ b/tests/test_ipython.py
@@ -0,0 +1,24 @@
+"""
+Test IPython/Jupyter display hooks
+"""
+
+import pikepdf
+import pytest
+
+
+@pytest.fixture
+def graph(resources):
+ return pikepdf.open(resources / 'graph.pdf')
+
+
+def test_display_page(graph):
+ page0 = graph.pages[0]
+ mimebundle = page0._repr_mimebundle_(include=None, exclude=None)
+ assert 'application/pdf' in mimebundle
+
+
+def test_display_image(graph):
+ im0 = graph.pages[0].Resources.XObject['/Im0']
+ pim = pikepdf.PdfImage(im0)
+ result = pim._repr_png_()
+ assert result[1:4] == b'PNG'