Refactored some test cases to use pytest.