Skip to content

Commit 2ffa55f

Browse files
author
Ignacio Quintero
committed
Fix broken unit tests
My previous commit broke a couple of unit tests. This fixes them.
1 parent 6834806 commit 2ffa55f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sagemaker/amazon/hyperparameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __get__(self, obj, objtype):
5252

5353
def __set__(self, obj, value):
5454
"""Validate the supplied value and set this hyperparameter to value"""
55-
value = self.data_type(value)
55+
value = None if value is None else self.data_type(value)
5656
self.validate(value)
5757
if '_hyperparameters' not in dir(obj):
5858
obj._hyperparameters = dict()

tests/unit/test_hyperparameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class Test(object):
1818

19-
blank = Hyperparameter(name="some-name")
19+
blank = Hyperparameter(name="some-name", data_type=int)
2020
elizabeth = Hyperparameter(name='elizabeth')
2121
validated = Hyperparameter(name="validated", validate=lambda value: value > 55, data_type=int)
2222

0 commit comments

Comments
 (0)