[#1452] Fix text preview tests
[#1452] Fix PEP8