title: How can I write automatic tests for this Python code?
body: <p>My script <code>core.py</code> which is found in the folder <code>preprocessing</code> takes a string and cleans it. It is part of a bigger model (see the last import, but it's unimportant). The <code>dict_english</code>, found in <code>app/core/preprocessing/constants</code>, is just a dictionary of uncommon English words that I replace with other words.</p>
  <pre><code>import string
  from app.core.preprocessing.constants import dict_english
  from app.core.generic.step import Step
  from typing import Optional
  from app.api.model.my_project_parameters import MyProjectParameters
  
  class TextPreprocessingBase(Step[str, str]):
      def process(self, input_value: str, parameters: Optional[MyProjectParameters] = None) -&gt; str:
          input_value = input_value.replace(&quot;'&quot;, '')
          input_value = input_value.replace(&quot;\&quot;&quot;, '')
          printable = set(string.printable)
          filter(lambda x: x in printable, input_value)
          new_string=''.join(filter(lambda x: x in printable, input_value))
          return new_string
  
  class TextPreprocessingEnglish(TextPreprocessingBase):
      def process(self, input_value: str, parameters: Optional[MyProjectParameters] = None) -&gt; str:
          process_english = super().process(input_value, parameters)
          for word, initial in dict_english.items():
              process_english = process_english.replace(word.lower(), initial)
          return process_english
  </code></pre>
  <p>It's easy to test:</p>
  <pre><code>string_example= &quot;&quot;&quot; Random 'text' ✓&quot;&quot;&quot;
  
  a = TextPreprocessingEnglish()
  output = a.process(string_example)
  print(output)
  </code></pre>
  <p>It prints:</p>
  <pre><code>Random text
  </code></pre>
  <p>But I want to write some automatic tests. I thought:</p>
  <pre><code>import pytest
  from app.core.preprocessing.core import TextPreprocessingBase, TextPreprocessingEnglish
  class TestEnglishPreprocessing:
      @pytest.fixture(scope='class')
      def english_preprocessing:
      ...
  </code></pre>
  <p>But I'm stuck here. I just want to test my code on several various strings that I manually write. Is it possible to do this like that or do I just write it like the simple test example above?</p>