Pushing the envelope of the test functions in the Szego and Avram-Parter theorems