diff --git a/MANIFEST.in b/MANIFEST.in index f257d1b3..7852f404 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/pylatex/base_classes/containers.py b/pylatex/base_classes/containers.py index 65cbd33a..8aa02a91 100644 --- a/pylatex/base_classes/containers.py +++ b/pylatex/base_classes/containers.py @@ -8,9 +8,9 @@ from __future__ import annotations from collections import UserList +from collections.abc import Generator from contextlib import contextmanager from typing import TypeVar -from collections.abc import Generator from pylatex.utils import dumps_list diff --git a/tests/test_tabular.py b/tests/test_tabular.py index e9336430..69086049 100644 --- a/tests/test_tabular.py +++ b/tests/test_tabular.py @@ -1,11 +1,12 @@ #!/usr/bin/env python +import os.path as osp -from pylatex import Document, Section, Tabular, MultiColumn, StandAloneGraphic +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. @@ -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: @@ -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 @@ -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 = [ @@ -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)