Commit 606d87e2 authored by Levin Zimmermann's avatar Levin Zimmermann

erp5_core_test += Test '.astype('M8[ms]')' (numpy)

In nexedi/erp5@79fa584e we moved
some security definition from wendelin to erp5, but we didn't add any
tests anywhere. Recent project based tests revealed that this
migration actually failed [1]. We should therefore add a test for
this.

[1] nexedi/wendelin@f8678468 (comment 181134)

/reviewed-on nexedi/erp5!1757
parent 52701d37
......@@ -497,6 +497,17 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
expected=99
)
def testAstype(self):
self.createAndRunScript('''
import numpy as np
a = np.array([np.datetime64('1980')], dtype=[('date', '<M8[Y]')])
as_ms_type = a['date'][-1].astype('M8[ms]')
as_O_type = as_ms_type.astype('O')
return as_O_type.year
''',
expected=1980
)
def testPandasSeries(self):
self.createAndRunScript('''
import pandas as pd
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment