# Path: terminaltables/width_and_alignment.py
# def column_max_width(inner_widths, column_number, outer_border, inner_border, padding):
#     """Determine the maximum width of a column based on the current terminal width.
# 
#     :param iter inner_widths: List of widths (no padding) for each column.
#     :param int column_number: The column number to query.
#     :param int outer_border: Sum of left and right outer border visible widths.
#     :param int inner_border: Visible width of the inner border character.
#     :param int padding: Total padding per cell (left + right padding).
# 
#     :return: The maximum width the column can be without causing line wrapping.
#     """
#     column_count = len(inner_widths)
#     terminal_width = terminal_size()[0]
# 
#     # Count how much space padding, outer, and inner borders take up.
#     non_data_space = outer_border
#     non_data_space += inner_border * (column_count - 1)
#     non_data_space += column_count * padding
# 
#     # Exclude selected column's width.
#     data_space = sum(inner_widths) - inner_widths[column_number]
# 
#     return terminal_width - data_space - non_data_space
# 
# 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


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




@pytest.fixture(autouse=True)
def patch(monkeypatch):
    """Monkeypatch before every test function in this module.

    :param monkeypatch: pytest fixture.
    """
    monkeypatch.setattr('terminaltables.width_and_alignment.terminal_size', lambda: (79, 24))


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

# Path: terminaltables/width_and_alignment.py
# def column_max_width(inner_widths, column_number, outer_border, inner_border, padding):
#     """Determine the maximum width of a column based on the current terminal width.
# 
#     :param iter inner_widths: List of widths (no padding) for each column.
#     :param int column_number: The column number to query.
#     :param int outer_border: Sum of left and right outer border visible widths.
#     :param int inner_border: Visible width of the inner border character.
#     :param int padding: Total padding per cell (left + right padding).
# 
#     :return: The maximum width the column can be without causing line wrapping.
#     """
#     column_count = len(inner_widths)
#     terminal_width = terminal_size()[0]
# 
#     # Count how much space padding, outer, and inner borders take up.
#     non_data_space = outer_border
#     non_data_space += inner_border * (column_count - 1)
#     non_data_space += column_count * padding
# 
#     # Exclude selected column's width.
#     data_space = sum(inner_widths) - inner_widths[column_number]
# 
#     return terminal_width - data_space - non_data_space
# 
# 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


# Path: tests/test_width_and_alignment/test_column_max_width.py
import pytest
from terminaltables.width_and_alignment import column_max_width, max_dimensions

"""Test function in module."""




@pytest.fixture(autouse=True)
def patch(monkeypatch):
    """Monkeypatch before every test function in this module.

    :param monkeypatch: pytest fixture.
    """
    monkeypatch.setattr('terminaltables.width_and_alignment.terminal_size', lambda: (79, 24))


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

    assert column_max_width(max_dimensions([['', '', ''], ['', '', '']])[0], 0, 0, 0, 0) == 79