From 2eac91dd4f6d7ed94cf9cea10d5fa913e02e87c3 Mon Sep 17 00:00:00 2001
From: Brady James Garvin <bgarvin@cse.unl.edu>
Date: Tue, 3 Aug 2021 10:49:52 -0500
Subject: [PATCH] Split method into two parts in order to demonstrate expected
 exceptions.

---
 main.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/main.py b/main.py
index 605d4a8..07a5039 100644
--- a/main.py
+++ b/main.py
@@ -39,19 +39,26 @@ class SmallestPositiveApp(App):
             pass
 
     @staticmethod
-    def _find_smallest_positive(entries):
-        smallest_positive = inf
+    def _extract_numbers(entries):
+        results = []
         for entry in entries:
             try:
                 value = float(entry)
-                if 0 < value < smallest_positive:
-                    smallest_positive = value
+                results.append(value)
             except ValueError:
                 pass
+        return results
+
+    @staticmethod
+    def _find_smallest_positive(values):
+        smallest_positive = inf
+        for value in values:
+            if 0 < value < smallest_positive:
+                smallest_positive = value
         return smallest_positive
 
     def on_entries(self, _, __):
-        self.result = SmallestPositiveApp._find_smallest_positive(self.entries)
+        self.result = SmallestPositiveApp._find_smallest_positive(SmallestPositiveApp._extract_numbers(self.entries))
 
     def set_entry(self, index, entry):
         self.entries[index] = entry
-- 
GitLab