def test_add_unit(self): try: add_unit('ft', '20*m') except KeyError as err: self.assertEqual( err.args[0], "Unit 'ft' already defined with different factor or powers.") else: self.fail("Expecting Key Error") try: add_offset_unit('degR', 'degK', 20, 10) except KeyError as err: self.assertEqual( err.args[0], "Unit 'degR' already defined with different factor or powers.") else: self.fail("Expecting Key Error")
def test_add_unit(self): try: add_unit('ft', '20*m') except KeyError as err: self.assertEqual( str(err), "'Unit ft already defined with different factor or powers'") else: self.fail("Expecting Key Error") try: add_offset_unit('degR', 'degK', 20, 10) except KeyError as err: self.assertEqual( str(err), "'Unit degR already defined with different factor or powers'") else: self.fail("Expecting Key Error")