Add unittests to AssignAndWeight. They include a test for the issue that was fixed with !995 (merged).