def test_issue_155(self): """ Langmuir.max_motive raises ValueError There's a case where the `Langmuir.max_motive` method will raise a `ValueError`. Specifically when `self.critical_point_current_density() == self.calc_saturation_point_current_density()`. This condition is tested to ensure the `ValueError` is not raised. See: https://github.com/jrsmith3/tec/issues/155 """ em_params = {'barrier': 1.0, 'emissivity': 0.0, 'position': 0.0, 'richardson': 10.0, 'temp': 300.0, 'voltage': 0.0} co_params = {'barrier': 1.0, 'emissivity': 0.0, 'position': 1.0, 'richardson': 10.0, 'temp': 300.0, 'voltage': 0.0} em = Metal.from_dict(em_params) co = Metal.from_dict(co_params) l = Langmuir(em, co) try: l.max_motive() except ValueError: self.fail("Issue #155 not resolved")
def test_issue_155(self): """ Langmuir.max_motive raises ValueError There's a case where the `Langmuir.max_motive` method will raise a `ValueError`. Specifically when `self.critical_point_current_density() == self.calc_saturation_point_current_density()`. This condition is tested to ensure the `ValueError` is not raised. See: https://github.com/jrsmith3/tec/issues/155 """ em_params = { 'barrier': 1.0, 'emissivity': 0.0, 'position': 0.0, 'richardson': 10.0, 'temp': 300.0, 'voltage': 0.0 } co_params = { 'barrier': 1.0, 'emissivity': 0.0, 'position': 1.0, 'richardson': 10.0, 'temp': 300.0, 'voltage': 0.0 } em = Metal.from_dict(em_params) co = Metal.from_dict(co_params) l = Langmuir(em, co) try: l.max_motive() except ValueError: self.fail("Issue #155 not resolved")
def test_from_dict_additional_arbitrary_keys(self): """ Metal.from_dict can be instantiated with additional arbitrary keys """ self.input_params["not_an_argument"] = "not_an_argument" try: el = Metal.from_dict(self.input_params) except TypeError: self.fail("Instantiation failed with additional arbitrary args")
def test_from_dict_additional_arbitrary_keys(self): """ Metal.from_dict can be instantiated with additional arbitrary keys """ self.input_params["not_an_argument"] = "not_an_argument" try: el = Metal.from_dict(self.input_params) except TypeError: self.fail("Instantiation failed with additional arbitrary args")
def test_from_dict_emissivity_non_numeric(self): """ Metal.from_dict instantiation requires numeric `emissivity` value """ self.input_params["emissivity"] = "this string is non-numeric." try: El = Metal.from_dict(self.input_params) except TypeError: # Attempting to instantiate a `tec.electrode.Metal` with a non-numeric `emissivity` argument raised a TypeError which is exactly what we wanted to do. pass else: self.fail("Shouldn't be able to instantiate with non-numeric `emissivity` argument.")
def test_from_dict_emissivity_non_numeric(self): """ Metal.from_dict instantiation requires numeric `emissivity` value """ self.input_params["emissivity"] = "this string is non-numeric." try: El = Metal.from_dict(self.input_params) except TypeError: # Attempting to instantiate a `tec.electrode.Metal` with a non-numeric `emissivity` argument raised a TypeError which is exactly what we wanted to do. pass else: self.fail( "Shouldn't be able to instantiate with non-numeric `emissivity` argument." )