Skip to content

fix: unique_hosts wraps set in redundant list() - #7

Open
andrewwhitecdw wants to merge 1 commit into
mainfrom
codequality/bobber-unique-hosts-wraps-set-in-redundant-list
Open

andrewwhitecdw wants to merge 1 commit into
mainfrom
codequality/bobber-unique-hosts-wraps-set-in-redundant-list

Conversation

@andrewwhitecdw

Copy link
Copy Markdown
Owner

This PR addresses the following issue in bobber/bobber.py: unique_hosts wraps set in redundant list().

Changes

  • bobber/bobber.py: unique_hosts wraps set in redundant list().

Details

--- a/bobber/bobber.py
+++ b/bobber/bobber.py
@@ -1,1 +1,1 @@
-    if len(host_list) != len(list(set(host_list))):
+    if len(host_list) != len(set(host_list)):

Tests

  • tests/test_bobber_unique_hosts.py
--- /dev/null
+++ b/tests/test_bobber_unique_hosts.py
@@ -0,0 +1,15 @@
+import unittest
+from argparse import ArgumentTypeError
+import bobber.bobber as bobber_module
+
+
+class TestUniqueHosts(unittest.TestCase):
+    def test_returns_original_when_unique(self):
+        hosts = 'host1,host2,host3'
+        self.assertEqual(bobber_module.unique_hosts(hosts), hosts)
+
+    def test_rejects_duplicates(self):
+        hosts = 'host1,host1,host2'
+        with self.assertRaises(ArgumentTypeError):
+            bobber_module.unique_hosts(hosts)

Contributor guidelines

Per this repo's CONTRIBUTING.md:

  • All commits are signed off (Signed-off-by trailer, DCO).

Signed-off-by: Andrew White <andrewh@cdw.com>
@andrewwhitecdw andrewwhitecdw added the sweep-approved Approved for upstream promotion by nvidia-sweep label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep-approved Approved for upstream promotion by nvidia-sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant