Move and expand "frequencies" test, and fixes for PEP-8

I moved the unit test for frequencies to test_core, added two new
tests for same, and also PEP-8'ed the code (mostly added spacing where
the spec requires).