Answer the architecture and stability reviews' first round: exempt rows, restored item 6, retired decisions
This commit is contained in:
+33
-13
@@ -1,3 +1,5 @@
|
||||
import contextlib
|
||||
import io
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -26,11 +28,12 @@ TODO = """# todo
|
||||
|
||||
## Items
|
||||
|
||||
| ID | Release | Item | R | S | A | G | Goals | Score |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| 1 | 0.2.0 | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 0 |
|
||||
| 2 | 0.1.0 | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |
|
||||
| 3 | 0.1.0 | **Make it fast.** | 3 | 8 | 6 | 8 | 2.1, 1 | 0 |
|
||||
| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| 1 | 0.2.0 | | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 0 |
|
||||
| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |
|
||||
| 3 | 0.1.0 | | **Make it fast, `a \| b`.** | 3 | 8 | 6 | 8 | 2.1, 1 | 0 |
|
||||
| 4 | 0.1.0 | security | **Rotate the leaked key.** | 9 | 2 | 1 | 1 | 2.1 | 0 |
|
||||
|
||||
## Details
|
||||
|
||||
@@ -41,6 +44,10 @@ Later detail.
|
||||
### 3. Make it fast.
|
||||
|
||||
Fast detail.
|
||||
|
||||
## Notes
|
||||
|
||||
Kept as written.
|
||||
"""
|
||||
|
||||
|
||||
@@ -50,11 +57,12 @@ class Rank(unittest.TestCase):
|
||||
|
||||
def test_scores_and_sorts_by_release_then_score_and_orders_the_details_to_match(self):
|
||||
text, under_bar = self.ranked()
|
||||
self.assertIn("""| 3 | 0.1.0 | **Make it fast.** | 3 | 8 | 6 | 8 | 2.1, 1 | 23.0 |
|
||||
| 2 | 0.1.0 | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 10.3 |
|
||||
| 1 | 0.2.0 | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 34.8 |
|
||||
self.assertIn("""| 4 | 0.1.0 | security | **Rotate the leaked key.** | 9 | 2 | 1 | 1 | 2.1 | -6.8 |
|
||||
| 3 | 0.1.0 | | **Make it fast, `a \\| b`.** | 3 | 8 | 6 | 8 | 2.1, 1 | 23.0 |
|
||||
| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 10.3 |
|
||||
| 1 | 0.2.0 | | **Ship the later thing.** | 1 | 1 | 9 | 9 | 1 | 34.8 |
|
||||
""", text)
|
||||
self.assertTrue(text.endswith("## Details\n\n### 3. Make it fast.\n\nFast detail.\n\n### 1. Ship the later thing.\n\nLater detail.\n"))
|
||||
self.assertTrue(text.endswith("## Details\n\n### 3. Make it fast, `a \\| b`.\n\nFast detail.\n\n### 1. Ship the later thing.\n\nLater detail.\n\n## Notes\n\nKept as written.\n"))
|
||||
self.assertEqual(under_bar, [])
|
||||
self.assertEqual(self.ranked(text), (text, []))
|
||||
|
||||
@@ -64,6 +72,9 @@ class Rank(unittest.TestCase):
|
||||
|
||||
def test_reads_goals_and_sub_goals_in_reading_order(self):
|
||||
self.assertEqual(rank_todo.readme_goals(README), ["1", "2", "2.1"])
|
||||
self.assertEqual(rank_todo.readme_goals(README.replace(" 1.", "\t1.")), ["1", "2", "2.1"])
|
||||
with self.assertRaises(rank_todo.Malformed):
|
||||
rank_todo.readme_goals(README.replace("2. Correct.", "1. Correct."))
|
||||
|
||||
def test_prints_the_positional_weights_when_they_stop_listing_the_readmes_goals(self):
|
||||
with self.assertRaises(rank_todo.Malformed) as raised:
|
||||
@@ -76,11 +87,16 @@ class Rank(unittest.TestCase):
|
||||
self.ranked(TODO.replace("-R - S/4 + 2*A + 2*G*W", formula))
|
||||
|
||||
def test_refuses_a_row_or_detail_off_the_format(self):
|
||||
row = "| 2 | 0.1.0 | | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |"
|
||||
broken = {
|
||||
"| 2 | 0.1.0 | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |": "| 2 | 0.1 | **Tighten the tests.** | 2 | 4 | 5 | 5 | 2.1 | 0 |",
|
||||
"| 3 | 0.1.0 | **Make it fast.** | 3 | 8 | 6 | 8 | 2.1, 1 | 0 |": "| 3 | 0.1.0 | Make it fast. | 3 | 11 | 6 | 8 | 7 | 0 |",
|
||||
"### 3. Make it fast.": "### 4. Make it fast.",
|
||||
"`Bar = 9`": "",
|
||||
row: row.replace("0.1.0", "0.1"),
|
||||
row + "\n": row.replace("5 | 5", "5 | ²") + "\n",
|
||||
"| 2.1 | 0 |\n\n## Details": "| 2.1 | 0 |\n\n| 9 | 0.1.0 | | **Stray.** | 1 | 1 | 1 | 1 | 1 | 0 |\n\n## Details",
|
||||
"| 4 | 0.1.0 | security |": "| 4 | 0.1.0 | later |",
|
||||
"Fast detail.": "```\n## Goals\n```",
|
||||
"### 3. Make it fast.": "### 5. Make it fast.",
|
||||
"`Bar = 9`": "`Bar = nan`",
|
||||
"-R - S/4 + 2*A + 2*G*W": "R / (S - 2)",
|
||||
}
|
||||
for old, new in broken.items():
|
||||
with self.subTest(new=new), self.assertRaises(rank_todo.Malformed):
|
||||
@@ -97,6 +113,10 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(todo.read_text(), TODO)
|
||||
self.assertEqual(rank_todo.main([str(todo)]), 0)
|
||||
self.assertEqual(rank_todo.main(["--check", str(todo)]), 0)
|
||||
pathlib.Path(temp, "README.md").unlink()
|
||||
with contextlib.redirect_stderr(io.StringIO()) as said:
|
||||
self.assertEqual(rank_todo.main([str(todo)]), 1)
|
||||
self.assertIn("README.md", said.getvalue())
|
||||
|
||||
|
||||
class ThisRepo(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user