Ask coding questions

← Back to all posts
How can I make my code look simpler and nicer???

How can I make my code look simpler by moving some code to setUp() block?

RoBlockHead (395)

For a python class, the __init__ method is called whenever the class is initalized (when you do new TestEmployee(100) or something) so it might make sense to rename setUp to __init__.
In terms of simplifying the code, there's not much that you can do, as it's already pretty simple. Think about what you want to happen right when you make a new TestEmployee, that's what should go in your __init__ or setUp method.

Coder100 (16874)

it's a test class, that doesn't apply i don't think @RoBlockHead