fix some test peculiarities

mostly fixed strange json behavior
because tests run python code from strings pyflakes was not detecting proper import usage