Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dask: Data.__round__ #370

Merged
merged 4 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions cf/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,19 +828,6 @@ def __float__(self):
"""
return float(self._get_dask())

def __round__(self, *ndigits):
"""Called to implement the built-in function `round`

x.__round__(*ndigits) <==> round(x, *ndigits)

"""
if self.size != 1:
raise TypeError(
"only length-1 arrays can be converted to Python scalars"
)

return round(self.datum(), *ndigits)

@daskified(_DASKIFIED_VERBOSE)
def __int__(self):
"""Called to implement the built-in function `int`
Expand Down
26 changes: 0 additions & 26 deletions cf/test/test_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2359,32 +2359,6 @@ def test_Data__int__(self):
with self.assertRaises(Exception):
_ = int(cf.Data([1, 2]))

def test_Data__round__(self):
if self.test_only and inspect.stack()[0][3] not in self.test_only:
return

for ndigits in ([], [0], [1], [2], [3]):
for x in (
-1.9123,
-1.5789,
-1.4123,
-1.789,
0,
1.123,
1.0234,
1.412,
1.9345,
):
self.assertEqual(
round(cf.Data(x), *ndigits), round(x, *ndigits)
)
self.assertEqual(
round(cf.Data(x), *ndigits), round(x, *ndigits)
)

with self.assertRaises(Exception):
_ = round(cf.Data([1, 2]))

def test_Data_argmax(self):
if self.test_only and inspect.stack()[0][3] not in self.test_only:
return
Expand Down