Skip to content

Commit

Permalink
Make test pytest compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Jul 23, 2024
1 parent 919a69e commit 7a47e70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ recursive-include pylatex *.py
recursive-include python2_source/pylatex *.py
include versioneer.py
include examples/kitten.jpg
include examples/sample-logo.png
18 changes: 5 additions & 13 deletions tests/test_tabular.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python
import os.path as osp

from pylatex import Document, MultiColumn, Section, StandAloneGraphic, Tabular

# This file contains function that test several Tabular related functionality.


def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
def test_tabular_can_add_row_passing_many_arguments():
"""
Test that Tabular can add a row as described in the function body:
The first method is to pass the content of each cell as a separate argument.
Expand All @@ -16,6 +17,7 @@ def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
"""
doc = Document()
sample_logo_path = osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")

with doc.create(Section("Can Add Row Passing Many Arguments")):
with doc.create(Tabular("|c|c|", booktabs=True)) as table:
Expand All @@ -30,7 +32,7 @@ def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
doc.generate_pdf(clean_tex=False)


def test_tabular_can_add_row_passing_iterable(sample_logo_path):
def test_tabular_can_add_row_passing_iterable():
"""
Test that Tabular can add a row as described in the function body:
The second method
Expand All @@ -44,6 +46,7 @@ def test_tabular_can_add_row_passing_iterable(sample_logo_path):
"""
doc = Document()

sample_logo_path = osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")
with doc.create(Section("Can Add Row Passing Iterable")):
with doc.create(Tabular("|c|c|", booktabs=True)) as table:
multi_columns_array = [
Expand All @@ -57,14 +60,3 @@ def test_tabular_can_add_row_passing_iterable(sample_logo_path):

table.add_row(multi_columns_array)
doc.generate_pdf()


if __name__ == "__main__":
import os.path as osp

sample_logo_path = osp.abspath(
osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")
)

test_tabular_can_add_row_passing_many_arguments(sample_logo_path=sample_logo_path)
test_tabular_can_add_row_passing_iterable(sample_logo_path=sample_logo_path)

0 comments on commit 7a47e70

Please sign in to comment.