Spaces:
Sleeping
Sleeping
| def test_make_cell(): | |
| """ | |
| Test the make_cell function. | |
| """ | |
| import numpy as np | |
| from app.tabs.submit_functions import make_cell | |
| # Arrange | |
| value = "Hello, World!" | |
| bbox = [10, 20, 30, 40] | |
| # Act | |
| cell = make_cell(value, bbox) | |
| # Assert | |
| expected_polygon = ((0, -5), (40, -5), (40, 25), (0, 25), (0, -5)) | |
| assert np.array_equal(cell.polygon, expected_polygon) | |
| def test_make_cell_for_text_position(): | |
| """ | |
| Test the make_cell function for text position. | |
| """ | |
| import numpy as np | |
| from app.tabs.submit_functions import make_cell | |
| # Arrange | |
| value = "Hello, World!" | |
| bbox = [10, 20, 30, 40] | |
| # Act | |
| cell = make_cell(value, bbox) | |
| # Assert | |
| text_position = 10, 10 | |
| assert (cell.text_x, cell.text_y) == text_position |