Skip to content
Snippets Groups Projects
Commit f5024352 authored by ml bonhomme's avatar ml bonhomme :bee:
Browse files

bunch of fixes

parent 827abba1
No related branches found
No related tags found
1 merge request!139Text orientation in base worker
Pipeline #78862 passed
......@@ -791,6 +791,40 @@ def test_create_transcriptions_orientation(responses, mock_elements_worker_with_
],
}
# Check that oriented transcriptions were properly stored in SQLite cache
assert list(CachedTranscription.select()) == [
CachedTranscription(id=UUID("00000000-0000-0000-0000-000000000000")),
CachedTranscription(id=UUID("11111111-1111-1111-1111-111111111111")),
]
assert [
{
k: getattr(transcription, k)
for k in [
"id",
"text",
"confidence",
"orientation",
"worker_version_id",
]
}
for transcription in CachedTranscription.select()
] == [
{
"id": UUID("00000000-0000-0000-0000-000000000000"),
"text": "Animula vagula blandula",
"confidence": 0.12,
"orientation": TextOrientation.HorizontalRightToLeft.value,
"worker_version_id": UUID("12341234-1234-1234-1234-123412341234"),
},
{
"id": UUID("11111111-1111-1111-1111-111111111111"),
"text": "Hospes comesque corporis",
"confidence": 0.21,
"orientation": TextOrientation.VerticalLeftToRight.value,
"worker_version_id": UUID("12341234-1234-1234-1234-123412341234"),
},
]
def test_create_element_transcriptions_wrong_element(mock_elements_worker):
with pytest.raises(AssertionError) as e:
......@@ -1390,7 +1424,7 @@ def test_create_element_transcriptions_with_cache(
element_id=UUID("11111111-1111-1111-1111-111111111111"),
text="The",
confidence=0.5,
orientation=TextOrientation.HorizontalLeftToRight,
orientation=TextOrientation.HorizontalLeftToRight.value,
worker_version_id=UUID("12341234-1234-1234-1234-123412341234"),
),
CachedTranscription(
......@@ -1398,7 +1432,7 @@ def test_create_element_transcriptions_with_cache(
element_id=UUID("22222222-2222-2222-2222-222222222222"),
text="first",
confidence=0.75,
orientation=TextOrientation.HorizontalLeftToRight,
orientation=TextOrientation.HorizontalLeftToRight.value,
worker_version_id=UUID("12341234-1234-1234-1234-123412341234"),
),
CachedTranscription(
......@@ -1406,7 +1440,7 @@ def test_create_element_transcriptions_with_cache(
element_id=UUID("11111111-1111-1111-1111-111111111111"),
text="line",
confidence=0.9,
orientation=TextOrientation.HorizontalLeftToRight,
orientation=TextOrientation.HorizontalLeftToRight.value,
worker_version_id=UUID("12341234-1234-1234-1234-123412341234"),
),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment