| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Expand Up | @@ -140,9 +140,21 @@ def test_calls_before_prepare(self): | |||||||||||||
| def test_prepare_multiple_times(self): | ||||||||||||||
| ts = graphlib.TopologicalSorter() | ||||||||||||||
| ts.prepare() | ||||||||||||||
| with self.assertRaisesRegex(ValueError, r"cannot prepare\(\) more than once"): | ||||||||||||||
| ts.prepare() | ||||||||||||||
|
|
||||||||||||||
| def test_prepare_after_pass_out(self): | ||||||||||||||
| ts = graphlib.TopologicalSorter({'a': 'bc'}) | ||||||||||||||
| ts.prepare() | ||||||||||||||
| self.assertEqual(set(ts.get_ready()), {'b', 'c'}) | ||||||||||||||
| with self.assertRaisesRegex(ValueError, r"cannot prepare\(\) after starting sort"): | ||||||||||||||
| ts.prepare() | ||||||||||||||
|
|
||||||||||||||
| def test_prepare_cycleerror_each_time(self): | ||||||||||||||
| ts = graphlib.TopologicalSorter({'a': 'b', 'b': 'a'}) | ||||||||||||||
| for attempt in range(1, 4): | ||||||||||||||
| with self.assertRaises(graphlib.CycleError, msg=f"{attempt=}"): | ||||||||||||||
| ts.prepare() | ||||||||||||||
|
Comment thread
Comment on lines
+154
to
+156
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
You can also use subTest() if you want.
Sorry, something went wrong.
All reactions
|
||||||||||||||
|
|
||||||||||||||
| def test_invalid_nodes_in_done(self): | ||||||||||||||
| ts = graphlib.TopologicalSorter() | ||||||||||||||
| ts.add(1, 2, 3, 4) | ||||||||||||||
| Expand Down | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Allow :meth:`graphlib.TopologicalSorter.prepare` to be called more than once | ||
| as long as sorting has not started. | ||
| Patch by Daniel Pope. |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.