-
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.
Merge pull request #184 from Mdwiki-TD/update
1
- Loading branch information
Showing
4 changed files
with
71 additions
and
83 deletions.
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
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
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
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,29 @@ | ||
""" | ||
python3 core8/pwb.py copy_to_en/tests/test_alltext_changes | ||
""" | ||
import unittest | ||
from pathlib import Path | ||
from copy_to_en.bots import alltext_changes | ||
|
||
|
||
class TestAllTextChanges(unittest.TestCase): | ||
def setUp(self): | ||
self.test_file = Path(__file__).parent / "sample_text.txt" | ||
with open(self.test_file) as f: | ||
self.test_text = f.read() | ||
|
||
def test_change_last_section(self): | ||
result = alltext_changes.do_alltext_changes(self.test_text) | ||
self.assertNotIn("[[Category:", result.split("\n")[-1]) | ||
self.assertNotIn("[[azb:", result) | ||
|
||
def test_do_all_text(self): | ||
result = alltext_changes.do_all_text(self.test_text, "12345", "{{#unlinkedwikibase:id=Q123}}") | ||
self.assertIn("{{mdwiki revid|12345}}", result) | ||
self.assertIn("[[Category:Mdwiki Translation Dashboard articles/fulltext]]", result) | ||
# self.assertIn("[[Category:Mdwiki Translation Dashboard articles/fulltext]]!", result) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |