Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pybool(self):
for fstr_true in ('true', '.true.', 't', '.t.'):
self.assertEqual(pybool(fstr_true), True)
for fstr_false in ('false', '.false.', 'f', '.f.'):
self.assertEqual(pybool(fstr_false), False)
for fstr_true in ('ture', '.t'):
self.assertEqual(pybool(fstr_true, strict_logical=False), True)
for fstr_false in ('flase', '.f'):
self.assertEqual(pybool(fstr_false, strict_logical=False), False)
for fstr in ('ture', '.t', 'flase', '.f'):
self.assertRaises(ValueError, pybool, fstr)
for fstr in ('g', '.', 'xyz'):
self.assertRaises(ValueError, pybool, fstr, strict_logical=False)
def test_pybool(self):
for fstr_true in ('true', '.true.', 't', '.t.'):
self.assertEqual(pybool(fstr_true), True)
for fstr_false in ('false', '.false.', 'f', '.f.'):
self.assertEqual(pybool(fstr_false), False)
for fstr_true in ('ture', '.t'):
self.assertEqual(pybool(fstr_true, strict_logical=False), True)
for fstr_false in ('flase', '.f'):
self.assertEqual(pybool(fstr_false, strict_logical=False), False)
for fstr in ('ture', '.t', 'flase', '.f'):
self.assertRaises(ValueError, pybool, fstr)
for fstr in ('g', '.', 'xyz'):
self.assertRaises(ValueError, pybool, fstr, strict_logical=False)
def test_pybool(self):
for fstr_true in ('true', '.true.', 't', '.t.'):
self.assertEqual(pybool(fstr_true), True)
for fstr_false in ('false', '.false.', 'f', '.f.'):
self.assertEqual(pybool(fstr_false), False)
for fstr_true in ('ture', '.t'):
self.assertEqual(pybool(fstr_true, strict_logical=False), True)
for fstr_false in ('flase', '.f'):
self.assertEqual(pybool(fstr_false, strict_logical=False), False)
for fstr in ('ture', '.t', 'flase', '.f'):
self.assertRaises(ValueError, pybool, fstr)
for fstr in ('g', '.', 'xyz'):
self.assertRaises(ValueError, pybool, fstr, strict_logical=False)
def test_pybool(self):
for fstr_true in ('true', '.true.', 't', '.t.'):
self.assertEqual(pybool(fstr_true), True)
for fstr_false in ('false', '.false.', 'f', '.f.'):
self.assertEqual(pybool(fstr_false), False)
for fstr_true in ('ture', '.t'):
self.assertEqual(pybool(fstr_true, strict_logical=False), True)
for fstr_false in ('flase', '.f'):
self.assertEqual(pybool(fstr_false, strict_logical=False), False)
for fstr in ('ture', '.t', 'flase', '.f'):
self.assertRaises(ValueError, pybool, fstr)
for fstr in ('g', '.', 'xyz'):
self.assertRaises(ValueError, pybool, fstr, strict_logical=False)
self._update_tokens(write_token)
v_im = self.token
self._update_tokens(write_token)
assert self.token == ')'
self._update_tokens(write_token, override)
v_str = '({0}, {1})'.format(v_re, v_im)
recast_funcs = [int, pyfloat, pycomplex, pybool, pystr]
for f90type in recast_funcs:
try:
# Unclever hack.. integrate this better
if f90type == pybool:
value = pybool(v_str, self.strict_logical)
else:
value = f90type(v_str)
return value
except ValueError:
continue