Ejemplo n.º 1
0
 def setUp(self):
     self.tol = 1e-23
     self.Fe78_res_dict = load_json_file(resolve_resource("pyisocalc", "single_pattern", "Fe78"))
Ejemplo n.º 2
0
        'charge': lambda: 0
    }),
    'H': SimpleMock({
        'get_segments': lambda: [SegmentStub(element_stubs['H'], 1)],
        'charge': lambda: 1
    }),
    'Fe100H89O10': SimpleMock({
        'get_segments': lambda: [SegmentStub(element_stubs['Fe'], 100), SegmentStub(element_stubs['H'], 89),
                                 SegmentStub(element_stubs['O'], 10)],
        'charge': lambda: 369
    })
}

chemcalc_ref_values = {}
for sf_str in sf_stubs:
    fn = resolve_resource("pyisocalc", "perfect_pattern", sf_str)
    res_dict = load_json_file(fn)
    chemcalc_ref_values[sf_str] = res_dict


class ElementTest(unittest.TestCase):
    def test_init(self):
        valid_args = ('H', 'Ar', 1, 49)
        valueerror_args = ('', 'foo', -45, 2345)
        typeerror_args = (1.0, None)
        for arg in valid_args:
            Element(arg)
        for arg in valueerror_args:
            self.assertRaises(ValueError, Element, arg)
        for arg in typeerror_args:
            self.assertRaises(TypeError, Element, arg)