Commit 707f1e91 authored by Levin Zimmermann's avatar Levin Zimmermann

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

In 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] wendelin@f8678468 (comment 181134)
parent 9e26d2aa
Pipeline #27208 failed with stage
in 0 seconds
...@@ -497,6 +497,16 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase): ...@@ -497,6 +497,16 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
expected=99 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]')
return as_ms_type.tolist().time().hour
''',
expected=0
)
def testPandasSeries(self): def testPandasSeries(self):
self.createAndRunScript(''' self.createAndRunScript('''
import pandas as pd 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