@@ -292,29 +292,13 @@ def test_general_syntax_errors(self):
292292msgstr "bar"
293293''' ,
294294
295- # invalid plural index
296- # invalid but currently accepted
297- # '''
298- # msgid "foo"
299- # msgid_plural "foos"
300- # msgstr[foo] "baz"
301- # ''',
302-
303295 # invalid plural index
304296 '''
305297msgid "foo"
306298msgid_plural "foos"
307299msgstr[0 "baz"
308300''' ,
309301
310- # invalid plural index
311- # invalid but currently accepted
312- # '''
313- # msgid "foo"
314- # msgid_plural "foos"
315- # msgstr[] "baz"
316- # ''',
317-
318302 # invalid plural index
319303 '''
320304msgid "foo"
@@ -341,90 +325,6 @@ def test_general_syntax_errors(self):
341325
342326 def test_semantic_errors (self ):
343327 invalid_po_files = (
344- # missing msgid after msgctxt
345- # invalid but currently accepted
346- # 'msgctxt "foo"',
347-
348- # missing msgstr after msgid
349- # invalid but currently accepted
350- # 'msgid "foo"',
351-
352- # comment line not allowed after msgctxt
353- # invalid but currently accepted
354- # '''
355- # msgctxt "foo"
356- # # comment
357- # msgid "bar"
358- # msgstr "bar"
359- # ''',
360-
361- # comment line not allowed after msgid
362- # invalid but currently accepted
363- # '''
364- # msgid "foo"
365- # # comment
366- # msgstr "bar"
367- # ''',
368-
369- # comment line not allowed after msgid_plural
370- # invalid but currently accepted
371- # '''
372- # msgid "foo"
373- # msgid_plural "foos"
374- # # comment
375- # msgstr[0] "bar"
376- # ''',
377-
378- # msgctxt not allowed after msgctxt
379- # invalid but currently accepted
380- # '''
381- # msgctxt "foo"
382-
383- # msgctxt "bar"
384- # msgid "foo"
385- # msgstr "bar"
386- # ''',
387-
388- # msgctxt not allowed after msgid
389- # invalid but currently accepted
390- # '''
391- # msgid "foo"
392- # msgctxt "bar"
393-
394- # msgid "bar"
395- # msgstr "baz"
396- # ''',
397-
398- # msgctxt not allowed after msgid_plural
399- # invalid but currently accepted
400- # '''
401- # msgid "foo"
402- # msgid_plural "foos"
403- # msgctxt "bar"
404-
405- # msgid "bar"
406- # msgstr "baz"
407- # ''',
408-
409- # msgid not allowed after msgid
410- # invalid but currently accepted
411- # '''
412- # msgid "foo"
413-
414- # msgid "bar"
415- # msgstr "baz"
416- # ''',
417-
418- # msgid not allowed after msgid_plural
419- # invalid but currently accepted
420- # '''
421- # msgid "foo"
422- # msgid_plural "foos"
423-
424- # msgid "bar"
425- # msgstr "baz"
426- # ''',
427-
428328 # msgid_plural must be preceded by msgid
429329 '''
430330msgid_plural "foos"
@@ -442,17 +342,6 @@ def test_semantic_errors(self):
442342msgstr "baz"
443343''' ,
444344
445- # msgid_plural not allowed after msgid_plural
446- # invalid but currently accepted
447- # '''
448- # msgid "foo"
449- # msgid_plural "foos"
450- # msgid_plural "bars"
451-
452- # msgid "bar"
453- # msgstr "baz"
454- # ''',
455-
456345 # msgid_plural not allowed after msgctxt
457346 '''
458347msgctxt "foo"
@@ -480,16 +369,6 @@ def test_semantic_errors(self):
480369msgstr "baz"
481370''' ,
482371
483- # msgstr not allowed after comment
484- # invalid but currently accepted
485- # '''
486- # # comment
487- # # msgstr "foo"
488-
489- # msgid "bar"
490- # msgstr "baz"
491- # ''',
492-
493372 # msgstr not allowed after msgctxt
494373 '''
495374msgctxt "foo"
@@ -499,17 +378,6 @@ def test_semantic_errors(self):
499378msgstr "bar"
500379''' ,
501380
502- # msgstr not allowed after msgstr
503- # invalid but currently accepted
504- # '''
505- # msgid "foo"
506- # msgstr "bar"
507- # msgstr "baz"
508-
509- # msgid "bar"
510- # msgstr "baz"
511- # ''',
512-
513381 # missing msgid_plural section
514382 '''
515383msgid "foo"
@@ -530,23 +398,6 @@ def test_semantic_errors(self):
530398
531399 def test_msgstr_invalid_indices (self ):
532400 invalid_po_files = (
533- # wrong plural form index
534- # invalid but currently accepted
535- # '''
536- # msgid "foo"
537- # msgid_plural "foos"
538- # msgstr[42] "bar"
539- # ''',
540-
541- # wrong plural form index
542- # invalid but currently accepted
543- # '''
544- # msgid "foo"
545- # msgid_plural "foos"
546- # msgstr[0] "bar"
547- # msgstr[42] "bars"
548- # ''',
549-
550401 # msgstr not pluralized
551402 '''
552403msgid "foo"
@@ -563,39 +414,6 @@ def test_msgstr_invalid_indices(self):
563414 with self .assertRaises (SystemExit ):
564415 msgfmt .make ('messages.po' , 'messages.mo' )
565416
566- def test_duplicate_entries (self ):
567- invalid_po_files = (
568- # duplicate msgid
569- # invalid but currently accepted
570- # '''
571- # msgid "foo"
572- # msgstr "bar"
573-
574- # msgid "foo"
575- # msgstr "baz"
576- # ''',
577-
578- # duplicate msgctxt+msgid
579- # invalid but currently accepted
580- # '''
581- # msgctxt "context"
582- # msgid "foo"
583- # msgstr "bar"
584-
585- # msgctxt "context"
586- # msgid "foo"
587- # msgstr "baz"
588- # '''
589- )
590- with temp_cwd ():
591- for invalid_po in invalid_po_files :
592- with self .subTest (invalid_po = invalid_po ):
593- Path ('messages.po' ).write_text (invalid_po )
594- # Reset the global MESSAGES dictionary
595- msgfmt .MESSAGES .clear ()
596- with self .assertRaises (SystemExit ):
597- msgfmt .make ('messages.po' , 'messages.mo' )
598-
599417
600418class CLITest (unittest .TestCase ):
601419
0 commit comments