Пример #1
0
 def test_scofield_dispatch(self, mock_func):
     """Check parametrised weightings are dispatched correctly"""
     self.assertEqual(get_cross_sections(42),
                      (42., None, 'SCOFIELD'))
     self.assertEqual(get_cross_sections('1.4e2',
                                         elements=['Sc', 'O']),
                      (1.4e2, ['Sc', 'O'], 'SCOFIELD'))
Пример #2
0
 def test_json_dispatch(self, mock_func):
     """Check JSON weighting files are dispatched correctly"""
     json_file = 'nonexistent.json'
     self.assertEqual(get_cross_sections(json_file),
                      (json_file, 'JSON'))
     self.assertEqual(get_cross_sections(json_file,
                                         elements=['Na']),
                      (json_file, 'JSON'))
Пример #3
0
 def test_yeh_old_keys(self):
     with self.assertRaises(ValueError):
         get_cross_sections('xps')
     with self.assertRaises(ValueError):
         get_cross_sections('ups')
     with self.assertRaises(ValueError):
         get_cross_sections('haxpes')
Пример #4
0
 def test_yeh_dispatch(self, mock_func):
     """Check tabulated weightings are dispatched correctly"""
     self.assertEqual(get_cross_sections('alka'), ('alka', 'YEH'))