Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Exploratory Testing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ryan Thomas
Exploratory Testing
Commits
2eac91dd
"xchart/git@git.unl.edu:bgarvin/XChart.git" did not exist on "3c61c6f1cb579d77e7d361500ee00807a71bb07a"
Commit
2eac91dd
authored
3 years ago
by
Brady James Garvin
Browse files
Options
Downloads
Patches
Plain Diff
Split method into two parts in order to demonstrate expected exceptions.
parent
eda69ca6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+12
-5
12 additions, 5 deletions
main.py
with
12 additions
and
5 deletions
main.py
+
12
−
5
View file @
2eac91dd
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment