def test_from_dict_additional_arbitrary_args(self): """ SC.from_dict can be instantiated with additional arbitrary args """ self.input_params["not_an_argument"] = "not_an_argument" try: el = SC.from_dict(self.input_params) except TypeError: self.fail("Instantiation failed with additional arbitrary args")
def test_from_dict_bandgap_non_numeric(self): """ SC.from_dict instantiation requires numeric `bandgap` value """ self.input_params["bandgap"] = "this string is non-numeric." try: El = SC.from_dict(self.input_params) except TypeError: # Attempting to instantiate a `tec.electrode.SC.from_dict` with a non-numeric `bandgap` argument raised a TypeError which is exactly what we wanted to do. pass else: self.fail("`bandgap` field of instantiating dict must be numeric.")
def test_acceptor_concentration_non_numeric(self): """ SC instantiation requires numeric `acceptor_concentration` value """ self.input_params[ "acceptor_concentration"] = "this string is non-numeric." try: El = SC(**self.input_params) except TypeError: # Attempting to instantiate a `tec.electrode.SC` with a non-numeric `acceptor_concentration` argument raised a TypeError which is exactly what we wanted to do. pass else: self.fail( "`acceptor_concentration` field of instantiating dict must be numeric." )
def setUp(self): """ Create dict attribute that can instantiate an `SC` object """ self.input_params = copy.copy(input_params) self.el = SC(**input_params)