def test_words(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text("First") pdf.add_text("Second") pdf.add_text("Bye!") pdf.save()
def test_table_many_columns(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) data = [[ "First Name", "Last Name", "Email", "First Name", "Last Name", "Email", "First Name", "Last Name", "Email" ], [ "John", "Red", "j.red example.org", "John", "Red", "j.red example.org", "John", "Red", "j.red example.org" ], [ "Sarah", "Leitz", "s.leitz example.org", "Sarah", "Leitz", "s.leitz example.org", "Sarah", "Leitz", "s.leitz example.org" ], [ "Tom", "Porter", "t.porter example.org", "Tom", "Porter", "t.porter example.org", "Tom", "Porter", "t.porter example.org" ], [ "Christie", "Owl", "c.owl example.org", "Christie", "Owl", "c.owl example.org", "Christie", "Owl", "c.owl example.org" ]] pdf.add_table(data) pdf.add_text(self.short_text) pdf.save()
def test_custom_page_size(self): pdf = SimplePdf(self._testMethodName + ".pdf", (500, 500)) pdf.add_text("First") pdf.add_text("Second") pdf.add_text("Bye!") pdf.save()
def test_large_image(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) pdf.add_image(self.large_image_filename) pdf.add_text(self.short_text) pdf.save()
def test_table_one_row(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) data = [["First Name", "Last Name", "Email"]] pdf.add_table(data) pdf.add_text(self.short_text) pdf.save()
def test_no_filename(self): pdf = SimplePdf() pdf.add_text("First") pdf.add_text("Second") pdf.add_text("Bye!") with self.assertRaises(TypeError): pdf.save()
def test_table_irregular_2(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) data = [["First Name", "Last Name"], ["Sarah", "Leitz", "*****@*****.**", "Buffalo, NY"], ["Tom", "Porter"], ["Christie", "Owl", "*****@*****.**"]] pdf.add_table(data) pdf.add_text(self.short_text) pdf.save()
def test_table_irregular(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) data = [["First Name", "Last Name", "Email", "Address"], ["John", "Red"], ["Sarah", "Leitz", "*****@*****.**"], ["Tom", "Porter"], ["Christie", "Owl", "*****@*****.**"]] pdf.add_table(data) pdf.add_text(self.short_text) pdf.save()
def test_large_table(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.short_text) data = [["First Name", "Last Name", "Email"], [self.short_text, self.short_text, "*****@*****.**"], [self.short_text, self.short_text, "*****@*****.**"], [self.short_text, self.short_text, "*****@*****.**"], [self.short_text, self.short_text, "*****@*****.**"]] pdf.add_table(data) pdf.add_text(self.short_text) pdf.save()
def test_long_text(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text(self.text) pdf.add_text(self.text) pdf.add_text(self.text) pdf.save()
def test_long_text_with_headers(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_header(self.long_header) pdf.add_text(self.text) pdf.add_header(self.short_header) pdf.add_text(self.text) pdf.add_header(self.short_header) pdf.add_text(self.text) pdf.save()
def test_no_content(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.save()
def test_filename_save_twice(self): pdf = SimplePdf() pdf.add_text("First") pdf.add_text("Second") pdf.add_text("Bye!") pdf.filename = self._testMethodName + "_1.pdf" pdf.save() print(pdf.parts) pdf.filename = self._testMethodName + "_2.pdf" pdf.save()
def test_filename_later(self): pdf = SimplePdf() pdf.add_text("First") pdf.add_text("Second") pdf.add_text("Bye!") pdf.filename = self._testMethodName + ".pdf" pdf.save()
def test_text_with_image(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_header(self.short_header) pdf.add_header(self.short_header) pdf.add_header(self.short_header) pdf.add_text(self.text) pdf.add_image(self.small_image_filename) pdf.add_text("End line") pdf.save()
def test_image(self): pdf = SimplePdf(self._testMethodName + ".pdf") pdf.add_text("First") pdf.add_image(self.small_image_filename) pdf.save()