Fix assert statement for ESQuery faceting

This code does some dynamic assignment, which is why that name must be a
valid python variable name.  I used an assert statement here to raise an
exception where the wrong name is used, rather than when the dynamic
assignment is made, so it's clearer where the problem is.

Because the assert statement was previously broken, code got in which
didn't fit this model, but it never raised an issue because that dynamic
assignment was never called on that code.

This whole model might be a bit too clever for its own good.  I'll do a
design review soon on this stuff, as that's one thing I've thought about
changing.
Add test for bad facet variable name
Merge pull request #4643 from dimagi/fix-assert

Fix assert statement for ESQuery faceting