Generalizing HWE tests to account for structure

Here’s a paper Extending Tests of Hardy–Weinberg Equilibrium to Structured Populations - PMC which enables a generalization for HWE to allow for structure.