Skip to content

Sample work · Code & Bugs

Code modernization: replaced outdated modules, behavior identical

An old Python script with modules that are removed in newer Python versions was modernized. Tests before and after, identical outputs byte for byte.

Sample work (demo), not a client job. Built as a trial task with invented example data; the check figures below come from the automatic test run and are not polished.

What was built

  • First, tests that capture the old behavior
  • Then replaced outdated building blocks: command line, time functions, type hints, formatting
  • Afterwards, the same tests pass successfully and without deprecation warnings

Download code-modernisierung-projekt.zip

How it was checked

Automatic test run on 2026-10-31, taken from the log (test data invented, figures measured):

  • 7/7 green
  • Tests green before 15/15, after 15/15
  • before: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
  • Legacy code before ['%-Formatierung', 'from optparse', 'import cgi', 'io.open', 'typing.Dict', 'typing.List', 'utcfromtimestamp'], after []

Limits

What this sample does not cover, so nobody expects more:

  • Sample: Python modernization (optparse->argparse, cgi->email, naive->UTC time, types/f-strings); jumping between frameworks (e.g., AngularJS->React, Python 2->3 with C extensions) is larger and ...
  • Behavior is maintained via characterization tests + golden outputs; command-line error messages may change in wording (exit code remains)
  • requests->httpx not part of the sample (requests is not installed in the tool environment)

Something like this for your business?

Describe briefly what you need. You get a fixed price before I start; nothing happens without your yes.

To the workshop