Skip to content

Commit 9ff67de

Browse files
committed
PR feedback
1 parent 2fd8df9 commit 9ff67de

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/citrine/_serialization/properties.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,11 @@ def underlying_types(self):
264264

265265
@property
266266
def serialized_types(self):
267-
return float, int, str
267+
return int, str
268268

269269
def _deserialize(self, value: SerializedInteger) -> int:
270270
if isinstance(value, bool):
271271
raise TypeError('value must be a Number, not a boolean.')
272-
elif isinstance(value, float):
273-
cast = round(value)
274-
if cast == value:
275-
return cast
276-
else:
277-
raise ValueError(f'{value} cannot be cast to an integer.')
278272
else:
279273
return int(value)
280274

src/citrine/gemd_queries/filter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ class AllIntegerFilter(Serializable['AllIntegerFilter'], PropertyFilterType):
4848
4949
Parameters
5050
----------
51-
lower: int
51+
lower: float
5252
The lower bound on this filter range.
53-
upper: int
53+
upper: float
5454
The upper bound on this filter range.
5555
inclusive: bool
5656
Whether the lower & upper bounds are included in the range.
5757
5858
"""
5959

60-
lower = properties.Integer('lower')
61-
upper = properties.Integer('upper')
60+
lower = properties.Float('lower')
61+
upper = properties.Float('upper')
6262
inclusive = properties.Optional(properties.Boolean, 'inclusive', default=True)
6363
typ = properties.String('type', default="all_integer_filter", deserializable=False)
6464

tests/_serialization/_data.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
VALID_SERIALIZATIONS = [
77
(properties.Integer, 5, 5),
8-
(properties.Integer, 5, 5.), # Accept passing a float-representation of an int to the setter
98
(properties.Float, 3.0, 3.0),
109
(properties.Raw, 1234, 1234),
1110
(properties.String, 'foo', 'foo'),

0 commit comments

Comments
 (0)