mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-13 09:31:46 +01:00
Add configurable document columns and allow bulk metadata editing (#14)
This commit is contained in:
@@ -5,6 +5,7 @@ import unittest
|
||||
from types import SimpleNamespace
|
||||
|
||||
from app.pipeline import DocumentProcessor
|
||||
from app.period import get_period_key_values
|
||||
|
||||
|
||||
class EmissionDateExtractionTests(unittest.TestCase):
|
||||
@@ -41,5 +42,28 @@ class EmissionDateExtractionTests(unittest.TestCase):
|
||||
self.assertIsNotNone(error)
|
||||
|
||||
|
||||
class PeriodKeyPlaceholderTests(unittest.TestCase):
|
||||
def test_key_values_use_the_computed_period_and_representative_day(self):
|
||||
values = get_period_key_values(
|
||||
"2026-01-20",
|
||||
{"granularity": "month", "offset": "previous"},
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
values,
|
||||
{"year": "2025", "month": "12", "month_name": "Décembre", "day": "20"},
|
||||
)
|
||||
|
||||
def test_key_pattern_renders_period_placeholders(self):
|
||||
processor = object.__new__(DocumentProcessor)
|
||||
|
||||
key = processor._format_key_pattern(
|
||||
"{year}/{month}/{month_name}/{day}/document.pdf",
|
||||
**get_period_key_values("2026-09-20", {"granularity": "month"}),
|
||||
)
|
||||
|
||||
self.assertEqual(key, "2026/09/Septembre/20/document.pdf")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user