def test_empty_file_route(self): universe = universal_translator.UnitsTranslator('') with self.assertRaises(FileNotFoundError): universe.read_file()
def test_not_a_number2(self): universe = universal_translator.UnitsTranslator('File examples/test.txt') with self.assertRaises(ValueError): universe.convert_unit(float('this is a test'), 'm', 'cm')
def test_unit_not_valid(self): universe = universal_translator.UnitsTranslator('File examples/test.txt') with self.assertRaises(KeyError): universe.convert_unit(25, 'm', 'c')
def test_is_a_directory(self): universe = universal_translator.UnitsTranslator('File examples') with self.assertRaises(IsADirectoryError): universe.read_file()
def test_file_does_not_exist(self): universe = universal_translator.UnitsTranslator('File examples/test22345.txt') with self.assertRaises(FileNotFoundError): universe.read_file()