smarter groups
This commit is contained in:
1 parent
ec1645a952
commit
261a50a7d2
2 files changed
+27
-16
No files matched your search
@@ -2236,6 +2236,23 @@ class StandardCliTests(unittest.TestCase):
|
||||
self.assertIn("Copie01", str(raised.exception))
|
||||
self.assertIn("cannot be split", str(raised.exception))
|
||||
|
||||
def test_grouped_batching_reuses_space_in_earlier_groups(self) -> None:
|
||||
module = self.modules["annotating_by_label"]
|
||||
rendered = [
|
||||
("01", "Ex 1", Image.new("RGB", (10, 70)), 0, []),
|
||||
("02", "Ex 1", Image.new("RGB", (10, 60)), 0, []),
|
||||
("03", "Ex 1", Image.new("RGB", (10, 40)), 0, []),
|
||||
("04", "Ex 1", Image.new("RGB", (10, 15)), 0, []),
|
||||
("04", "Ex 2", Image.new("RGB", (10, 15)), 0, []),
|
||||
]
|
||||
with patch.object(module, "MAX_HEIGHT_PX", 100):
|
||||
batches = module.split_batches(rendered)
|
||||
self.assertEqual([[item[0] for item in batch] for batch in batches],
|
||||
[["01", "04", "04"], ["02", "03"]])
|
||||
self.assertEqual([sum(item[2].height for item in batch) for batch in batches],
|
||||
[100, 100])
|
||||
self.assertEqual(batches[0][-2:], rendered[-2:])
|
||||
|
||||
def test_grouped_annotation_height_limit_is_32000_pixels(self) -> None:
|
||||
module = self.modules["annotating_by_label"]
|
||||
self.assertEqual(module.MAX_HEIGHT_PX, 32000)
|
||||
|
||||
Reference in new issue
Block a user