old_contents: """
  Tests for StopWordFactory
  """
  import os
  
  from unittest import TestCase
  
  from mots_vides.stop_words import StopWord
  from mots_vides.factory import StopWordFactory
  
  
  class StopWordFactoryTestCase(TestCase):
  
      factory = StopWordFactory(os.path.join(
          os.path.dirname(
              os.path.abspath(__file__)), 'datas/'
          )
      )
      language = 'foo'
      expection_file_collection = set(['bla', 'foo', 'bar',
                                       'woot', 'doublewoot'])
      expected_filename = 'foo.txt'
  
      def _flush_cash(self):
          pass
  
      def test_get_stopwords(self):
          sw = self.factory.get_stop_words(self.language)
          self.assertTrue(isinstance(sw, StopWord))
          self.assertEqual(sw.collection, self.expection_file_collection)
          self._flush_cash()
  
          sw = self.factory.get_stop_words('blabla', fail_safe=True)
          self.assertEqual(len(sw), 0)
          self._flush_cash()
  
          self.factory = StopWordFactory()
          self.assertRaises(
              Exception,
              lambda: self.factory.get_stop_words,
              'blabla'
          )
  
      def test_get_collection_filename(self):
          self.assertRaises(
              Exception,
              lambda: self.factory.get_collection_filename,
              'jkhj'
          )
          filename = self.factory.get_collection_filename('foo')
          self.assertEqual(filename, self.expected_filename)
  
new_contents: """
  Tests for StopWordFactory
  """
  import os
  
  from unittest import TestCase
  
  from mots_vides.stop_words import StopWord
  from mots_vides.factory import StopWordFactory
  from mots_vides.exceptions import StopWordError
  
  
  class StopWordFactoryTestCase(TestCase):
  
      def setUp(self):
          self.data_directory = os.path.join(
              os.path.dirname(
                  os.path.abspath(__file__)),
              'datas/')
          self.factory = StopWordFactory(self.data_directory)
  
      def test_get_stopwords(self):
          sw = self.factory.get_stop_words('foo')
          self.assertTrue(isinstance(sw, StopWord))
          self.assertEqual(list(sw.collection),
                           ['bla', 'foo', 'bar',
                            'woot', 'doublewoot'])
  
          sw = self.factory.get_stop_words('blabla', fail_safe=True)
          self.assertEqual(len(sw), 0)
  
          self.factory = StopWordFactory()
          self.assertRaises(StopWordError, self.factory.get_stop_words, 'blabla')
  
      def test_get_collection_filename(self):
          filename = self.factory.get_collection_filename('foo')
          self.assertTrue(filename.endswith('foo.txt'))
          self.assertTrue(filename.startswith(self.data_directory))
  
subject: Update the tests of the factory