def test_propose_merge_candidate_produces_valid_model(self):
    propModel, propSS = MergeMove.propose_merge_candidate(self.hmodel, self.SS, kA=0, kB=1)
    # Check number of components!    
    assert propSS.K == self.SS.K - 1
    self.verify_proposed_model(propModel, propSS)
    # Check that we can now do further E-steps and get sensible results
    LP = propModel.calc_local_params(self.Data)
    R = LP['resp']
    assert R.shape[0] == self.Data.nObs
    assert R.shape[1] == propSS.K
    assert not np.any(np.isnan(R))
    Neff = np.sum(R, axis=0)
    # Merger should cause new component "0" to explain twice as much data as
    # component 1. Let's verify this
    assert Neff[0] > 1.5*Neff[1]
    # Merged model should have mu for comp 0 (merged one) around -5
    mu0 = propModel.obsModel.get_mean_for_comp(0)
    distFromExpected = np.abs(mu0[0] - -5.0)
    assert distFromExpected < 1.0
    # Merged model should have mu for comp 1 near where only comp 2 was
    newMu1 = propModel.obsModel.get_mean_for_comp(1)
    oldMu2 = self.hmodel.obsModel.get_mean_for_comp(2)
    distFromExpected = np.max(np.abs(newMu1 - oldMu2))
    assert distFromExpected < 1.0
Child has two ForeignKeys to Parent, so if we don't specify which one
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/tests/merge/TestMergeDPMixModel.py/TestMergeMoveDPMixModel.test_propose_merge_candidate_produces_valid_model--crossover with--dataset/ETHPy150Open django/django/tests/inline_formsets/tests.py/InlineFormsetFactoryTest.test_exception_on_unspecified_foreign_key