paint-brush
Refactoring With Tests in Python: a Practical Exampleby@thedigicat
5,656 reads
5,656 reads

Refactoring With Tests in Python: a Practical Example

by The Digital CatApril 11th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

When dealing with untested or legacy code refactoring is dangerous and tests can help us do it the right way. Test Driven Refactoring (TDR) is different from TDD, but the two are closely related. In this post I want to show you how you can safely refactor such a class using tests. The effectiveness of this methodology depends strongly on the quality of the tests themselves, possibly more than when developing with TDD. As you will be able to infer from the final result, there is no reason to keep an object-oriented approach for this code.
featured image - Refactoring With Tests in Python: a Practical Example
The Digital Cat HackerNoon profile picture
The Digital Cat

The Digital Cat

@thedigicat

L O A D I N G
. . . comments & more!

About Author

The Digital Cat HackerNoon profile picture
The Digital Cat@thedigicat

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite