# Path: terminaltables/width_and_alignment.py
# def max_dimensions(table_data, padding_left=0, padding_right=0, padding_top=0, padding_bottom=0):
#     """Get maximum widths of each column and maximum height of each row.
# 
#     :param iter table_data: List of list of strings (unmodified table data).
#     :param int padding_left: Number of space chars on left side of cell.
#     :param int padding_right: Number of space chars on right side of cell.
#     :param int padding_top: Number of empty lines on top side of cell.
#     :param int padding_bottom: Number of empty lines on bottom side of cell.
# 
#     :return: 4-item tuple of n-item lists. Inner column widths and row heights, outer column widths and row heights.
#     :rtype: tuple
#     """
#     inner_widths = [0] * (max(len(r) for r in table_data) if table_data else 0)
#     inner_heights = [0] * len(table_data)
# 
#     # Find max width and heights.
#     for j, row in enumerate(table_data):
#         for i, cell in enumerate(row):
#             if not hasattr(cell, 'count') or not hasattr(cell, 'splitlines'):
#                 cell = str(cell)
#             if not cell:
#                 continue
#             inner_heights[j] = max(inner_heights[j], cell.count('\n') + 1)
#             inner_widths[i] = max(inner_widths[i], *[visible_width(l) for l in cell.splitlines()])
# 
#     # Calculate with padding.
#     outer_widths = [padding_left + i + padding_right for i in inner_widths]
#     outer_heights = [padding_top + i + padding_bottom for i in inner_heights]
# 
#     return inner_widths, inner_heights, outer_widths, outer_heights
# 
# def table_width(outer_widths, outer_border, inner_border):
#     """Determine the width of the entire table including borders and padding.
# 
#     :param iter outer_widths: List of widths (with padding) for each column.
#     :param int outer_border: Sum of left and right outer border visible widths.
#     :param int inner_border: Visible width of the inner border character.
# 
#     :return: The width of the table.
#     :rtype: int
#     """
#     column_count = len(outer_widths)
# 
#     # Count how much space outer and inner borders take up.
#     non_data_space = outer_border
#     if column_count:
#         non_data_space += inner_border * (column_count - 1)
# 
#     # Space of all columns and their padding.
#     data_space = sum(outer_widths)
#     return data_space + non_data_space


from terminaltables.width_and_alignment import max_dimensions, table_width
"""Test function in module."""



def test_empty():
    """Test with zero-length cells."""
    assert table_width(max_dimensions([['']])[2], 0, 0) == 0
    assert table_width(max_dimensions([['', '', '']])[2], 0, 0) == 0

# Path: terminaltables/width_and_alignment.py
# def max_dimensions(table_data, padding_left=0, padding_right=0, padding_top=0, padding_bottom=0):
#     """Get maximum widths of each column and maximum height of each row.
# 
#     :param iter table_data: List of list of strings (unmodified table data).
#     :param int padding_left: Number of space chars on left side of cell.
#     :param int padding_right: Number of space chars on right side of cell.
#     :param int padding_top: Number of empty lines on top side of cell.
#     :param int padding_bottom: Number of empty lines on bottom side of cell.
# 
#     :return: 4-item tuple of n-item lists. Inner column widths and row heights, outer column widths and row heights.
#     :rtype: tuple
#     """
#     inner_widths = [0] * (max(len(r) for r in table_data) if table_data else 0)
#     inner_heights = [0] * len(table_data)
# 
#     # Find max width and heights.
#     for j, row in enumerate(table_data):
#         for i, cell in enumerate(row):
#             if not hasattr(cell, 'count') or not hasattr(cell, 'splitlines'):
#                 cell = str(cell)
#             if not cell:
#                 continue
#             inner_heights[j] = max(inner_heights[j], cell.count('\n') + 1)
#             inner_widths[i] = max(inner_widths[i], *[visible_width(l) for l in cell.splitlines()])
# 
#     # Calculate with padding.
#     outer_widths = [padding_left + i + padding_right for i in inner_widths]
#     outer_heights = [padding_top + i + padding_bottom for i in inner_heights]
# 
#     return inner_widths, inner_heights, outer_widths, outer_heights
# 
# def table_width(outer_widths, outer_border, inner_border):
#     """Determine the width of the entire table including borders and padding.
# 
#     :param iter outer_widths: List of widths (with padding) for each column.
#     :param int outer_border: Sum of left and right outer border visible widths.
#     :param int inner_border: Visible width of the inner border character.
# 
#     :return: The width of the table.
#     :rtype: int
#     """
#     column_count = len(outer_widths)
# 
#     # Count how much space outer and inner borders take up.
#     non_data_space = outer_border
#     if column_count:
#         non_data_space += inner_border * (column_count - 1)
# 
#     # Space of all columns and their padding.
#     data_space = sum(outer_widths)
#     return data_space + non_data_space


# Path: tests/test_width_and_alignment/test_table_width.py
from terminaltables.width_and_alignment import max_dimensions, table_width

"""Test function in module."""



def test_empty():
    """Test with zero-length cells."""
    assert table_width(max_dimensions([['']])[2], 0, 0) == 0
    assert table_width(max_dimensions([['', '', '']])[2], 0, 0) == 0

    assert table_width(max_dimensions([['', '', ''], ['', '', '']])[2], 0, 0) == 0