def test_whitespace_strip(self):
     expected = ['line1', 'line2', 'line3']
     write = ['line1  ', 'line2\t', '  line3']
     with open(self.file, 'w') as fh:
         fh.writelines("\n".join(write))
     result = load_words(self.file)
     self.assertEqual(expected, result)
 def test_empty_file(self):
     with open(self.file, 'w') as fh:
         fh.write('')
     with self.assertRaises(EOFError):
         load_words(self.file)
 def test_missing_file(self):
     with self.assertRaises(IOError):
         load_words('nofile')
 def test_oneline(self):
     expected = ['line1line2line3']
     with open(self.file, 'w') as fh:
         fh.write(expected[0])
     result = load_words(self.file)
     self.assertEqual(expected, result)
 def test_good_load(self):
     expected = ['line1', 'line2', 'line3']
     with open(self.file, 'w') as fh:
         fh.writelines("\n".join(expected))
     result = load_words(self.file)
     self.assertEqual(expected, result)