Fixing deterministic and PEP8 issues in test