Преглед изворни кода

Fix `new_proposal.py` to include "Abstract" section (#2139)

"Proposal" was hard-coded as the first section and so it was deleting the "Abstract" section along with the "TODO" section.
josh11b пре 3 година
родитељ
комит
e489b14de0
2 измењених фајлова са 2 додато и 1 уклоњено
  1. 1 1
      proposals/scripts/new_proposal.py
  2. 1 0
      proposals/scripts/new_proposal_test.py

+ 1 - 1
proposals/scripts/new_proposal.py

@@ -98,7 +98,7 @@ def _fill_template(template_path: str, title: str, pr_num: int) -> str:
         r"\g<1>%d" % pr_num,
         content,
     )
-    content = re.sub(r"## TODO(?:.|\n)*(## Problem)", r"\1", content)
+    content = re.sub(r"\n## TODO(?:|\n)*?(\n## )", r"\1", content)
     return content
 
 

+ 1 - 0
proposals/scripts/new_proposal_test.py

@@ -50,6 +50,7 @@ class TestNewProposal(unittest.TestCase):
             "pull/123)" in content,
             content,
         )
+        self.assertTrue("\n## Abstract\n\n" in content, content)
 
     def test_run_success(self):
         new_proposal._run(["true"])