|
19 | 19 | from pywikitools.correctbot.correctors.base import CorrectorBase |
20 | 20 | from pywikitools.correctbot.correctors.de import GermanCorrector |
21 | 21 | from pywikitools.correctbot.correctors.fr import FrenchCorrector |
| 22 | +from pywikitools.correctbot.correctors.ro import RomanianCorrector |
22 | 23 | from pywikitools.correctbot.correctors.tr import TurkishCorrector |
23 | 24 | from pywikitools.correctbot.correctors.universal import ( |
24 | 25 | NoSpaceBeforePunctuationCorrector, |
@@ -545,6 +546,14 @@ def test_correct_quotes(self): |
545 | 546 | correct(corrector, '"Something" wrong"'), '"Something" wrong"' |
546 | 547 | ) |
547 | 548 |
|
| 549 | + def test_correct_quotes_spacing(self): |
| 550 | + corrector = QuotationMarkCorrectorTester() |
| 551 | + self.assertEqual(correct(corrector, "» Test«"), "»Test«") |
| 552 | + self.assertEqual(correct(corrector, "»Test «"), "»Test«") |
| 553 | + self.assertEqual( |
| 554 | + correct(corrector, "Start » word « end"), "Start »word« end" |
| 555 | + ) |
| 556 | + |
548 | 557 |
|
549 | 558 | class RTLCorrectorTester(CorrectorBase, RTLCorrector): |
550 | 559 | """With this class we can test the rules of RTLCorrector""" |
@@ -610,6 +619,9 @@ def test_correct_quotes(self): |
610 | 619 | correct(self.corrector, '"Das ist" seltsam"'), '"Das ist" seltsam"' |
611 | 620 | ) |
612 | 621 |
|
| 622 | + for spaced in ["„ Test “", "„Test “", "„ Test“"]: |
| 623 | + self.assertEqual(correct(self.corrector, spaced), "„Test“") |
| 624 | + |
613 | 625 | valid_strings: List[str] = [ # Some more complex examples |
614 | 626 | "(siehe Arbeitsblatt „[[Forgiving Step by Step/de|Schritte der Vergebung]]“)", |
615 | 627 | "[[How to Continue After a Prayer Time/de|„Wie es nach einer Gebetszeit weitergeht“]]", |
@@ -665,6 +677,24 @@ def test_suffix_for_print_version(self): |
665 | 677 | self.assertNotEqual(self.corrector._suffix_for_print_version(), "_print") |
666 | 678 |
|
667 | 679 |
|
| 680 | +class TestRomanianCorrector(CorrectorTestCase): |
| 681 | + @classmethod |
| 682 | + def setUpClass(cls): |
| 683 | + cls.corrector = RomanianCorrector() |
| 684 | + |
| 685 | + def test_correct_quotes(self): |
| 686 | + for spaced in ["„ cuvânt”", "„cuvânt ”", "„ cuvânt ”"]: |
| 687 | + self.assertEqual(correct(self.corrector, spaced), "„cuvânt”") |
| 688 | + self.assertEqual(correct(self.corrector, "„cuvânt”"), "„cuvânt”") |
| 689 | + self.assertEqual( |
| 690 | + correct(self.corrector, "Spune: „ da ” și „ nu ”"), |
| 691 | + "Spune: „da” și „nu”", |
| 692 | + ) |
| 693 | + |
| 694 | + def test_get_language_code(self): |
| 695 | + self.assertEqual(self.corrector._get_language_code(), "ro") |
| 696 | + |
| 697 | + |
668 | 698 | """TODO |
669 | 699 | class TestEnglishCorrector(unittest.TestCase): |
670 | 700 | def test_correct_apostrophe(self): |
|
0 commit comments