77from  textwrap  import  dedent 
88from  pathlib  import  Path 
99
10- < << << <<  HEAD 
1110from  test .support .script_helper  import  assert_python_ok , assert_python_failure 
12- from  test .test_tools  import  skip_if_missing , toolsdir 
13- from  test .support .os_helper  import  temp_cwd , temp_dir , change_cwd 
14- from  test .support .import_helper  import  unload 
15- == == == = 
16- from  test .support .script_helper  import  assert_python_ok 
1711from  test .test_tools  import  imports_under_tool , skip_if_missing , toolsdir 
1812from  test .support .os_helper  import  temp_cwd , temp_dir 
19- > >> >> >>  main 
2013
2114
2215skip_if_missing ()
@@ -505,7 +498,25 @@ def test_parse_keyword_spec(self):
505498            with  self .subTest (spec = spec ):
506499                self .assertEqual (parse_spec (spec ), expected )
507500
508- < << << <<  HEAD 
501+         invalid  =  (
502+             ('foo:' , "Invalid keyword spec 'foo:': missing argument positions" ),
503+             ('foo:bar' , "Invalid keyword spec 'foo:bar': position is not an integer" ),
504+             ('foo:0' , "Invalid keyword spec 'foo:0': argument positions must be strictly positive" ),
505+             ('foo:-2' , "Invalid keyword spec 'foo:-2': argument positions must be strictly positive" ),
506+             ('foo:1,1' , "Invalid keyword spec 'foo:1,1': duplicate positions" ),
507+             ('foo:1,2,1' , "Invalid keyword spec 'foo:1,2,1': duplicate positions" ),
508+             ('foo:1c,2,1c' , "Invalid keyword spec 'foo:1c,2,1c': duplicate positions" ),
509+             ('foo:1c,2,3c' , "Invalid keyword spec 'foo:1c,2,3c': msgctxt can only appear once" ),
510+             ('foo:1,2,3' , "Invalid keyword spec 'foo:1,2,3': too many positions" ),
511+             ('foo:1c' , "Invalid keyword spec 'foo:1c': msgctxt cannot appear without msgid" ),
512+         )
513+         for  spec , message  in  invalid :
514+             with  self .subTest (spec = spec ):
515+                 with  self .assertRaises (ValueError ) as  cm :
516+                     parse_spec (spec )
517+                 self .assertEqual (str (cm .exception ), message )
518+ 
519+ 
509520class  Test_msgfmt (unittest .TestCase ):
510521    """Tests for the msgfmt.py tool 
511522        bpo-35335 - bpo-9741 
@@ -719,28 +730,6 @@ def test_consecutive_make_calls(self):
719730        sys .path .pop ()
720731
721732
722- def  update_POT_snapshots ():
723-     for  input_file  in  DATA_DIR .glob ('*.py' ):
724- == == == = 
725-         invalid  =  (
726-             ('foo:' , "Invalid keyword spec 'foo:': missing argument positions" ),
727-             ('foo:bar' , "Invalid keyword spec 'foo:bar': position is not an integer" ),
728-             ('foo:0' , "Invalid keyword spec 'foo:0': argument positions must be strictly positive" ),
729-             ('foo:-2' , "Invalid keyword spec 'foo:-2': argument positions must be strictly positive" ),
730-             ('foo:1,1' , "Invalid keyword spec 'foo:1,1': duplicate positions" ),
731-             ('foo:1,2,1' , "Invalid keyword spec 'foo:1,2,1': duplicate positions" ),
732-             ('foo:1c,2,1c' , "Invalid keyword spec 'foo:1c,2,1c': duplicate positions" ),
733-             ('foo:1c,2,3c' , "Invalid keyword spec 'foo:1c,2,3c': msgctxt can only appear once" ),
734-             ('foo:1,2,3' , "Invalid keyword spec 'foo:1,2,3': too many positions" ),
735-             ('foo:1c' , "Invalid keyword spec 'foo:1c': msgctxt cannot appear without msgid" ),
736-         )
737-         for  spec , message  in  invalid :
738-             with  self .subTest (spec = spec ):
739-                 with  self .assertRaises (ValueError ) as  cm :
740-                     parse_spec (spec )
741-                 self .assertEqual (str (cm .exception ), message )
742- 
743- 
744733def  extract_from_snapshots ():
745734    snapshots  =  {
746735        'messages.py' : (),
@@ -754,7 +743,6 @@ def extract_from_snapshots():
754743
755744    for  filename , args  in  snapshots .items ():
756745        input_file  =  DATA_DIR  /  filename 
757- > >> >> >>  main 
758746        output_file  =  input_file .with_suffix ('.pot' )
759747        contents  =  input_file .read_bytes ()
760748        with  temp_cwd (None ):
@@ -771,6 +759,7 @@ def update_POT_snapshots():
771759        output_file .write_text (output , encoding = 'utf-8' )
772760
773761
762+ 
774763if  __name__  ==  '__main__' :
775764    # To regenerate POT files 
776765    if  len (sys .argv ) >  1  and  sys .argv [1 ] ==  '--snapshot-update' :
0 commit comments