-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rafael Marques
committed
Jul 31, 2024
1 parent
aceebf1
commit 8857b90
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION = "0.0.4" | ||
VERSION = "0.0.5" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import datetime | ||
|
||
from fastapi_translations.models import DocFile, Summary | ||
|
||
|
||
def test_must_compute_summary_when_adding_docfile(): | ||
doc1 = DocFile( | ||
translation_lang="es", | ||
original_file="/test/file1.md", | ||
original_commit=datetime.datetime(2024, 1, 1, 0, 0, 0), | ||
translation_file="/test/file1.md", | ||
translation_exists=True, | ||
translation_commit=datetime.datetime(2024, 1, 15, 0, 0, 0), | ||
translation_is_outdated=True | ||
) | ||
doc2 = DocFile( | ||
translation_lang="es", | ||
original_file="/test/file2.md", | ||
original_commit=datetime.datetime(2024, 1, 1, 0, 0, 0), | ||
translation_file="/test/file2.md", | ||
translation_exists=True, | ||
translation_commit=datetime.datetime(2024, 1, 1, 0, 0, 0), | ||
translation_is_outdated=False | ||
) | ||
doc3 = DocFile( | ||
translation_lang="es", | ||
original_file="/test/file3.md", | ||
original_commit=datetime.datetime(2024, 1, 1, 0, 0, 0), | ||
translation_file=None, | ||
translation_exists=False, | ||
translation_commit=None, | ||
translation_is_outdated=False | ||
) | ||
summary = Summary(lang="es") | ||
summary.append_file(doc1) | ||
summary.append_file(doc2) | ||
summary.append_file(doc3) | ||
|
||
assert summary.files_analyzed == 3 | ||
assert summary.files_missing_translation == 1 | ||
assert summary.files_outdated == 1 | ||
assert summary.files_translated == 2 |