def test_read_datafile_not_found(self): temp_path = os.path.join(tempfile.gettempdir(), 'wlg_test_not_found') with self.assertRaises(IOError): whatlastgenre.read_datafile(temp_path)
def test_read_datafile_external(self): with NamedTemporaryFile(delete=False) as temp_file: temp_file.write('\n aBc \n xYz\n\n') res = whatlastgenre.read_datafile(temp_file.name) self.assertEqual(res, ['abc', 'xyz']) os.unlink(temp_file.name)
def test_read_datafile_empty(self): with NamedTemporaryFile() as temp_file: res = whatlastgenre.read_datafile(temp_file.name) self.assertEqual(res, [])
def test_read_datafile_internal(self): res = whatlastgenre.read_datafile('data/genres.txt') self.assertIsNotNone(res)
def test_read_datafile_empty(self): with NamedTemporaryFile() as temp_file: res = whatlastgenre.read_datafile(temp_file.name) self.assertEquals(res, [])