Wilcoxon signed-rank test can be a test for comparing means but not for comparing medians? Wikipedia says that we can rewrite the hypotheses of the one-sample Wilcoxon signed-rank test in terms of expected value (as "a test for the location of the mean") if the following assumptions are met (below we have random iid sample $(X_1,\ldots,X_n) \overset{\text{iid}}{\sim} F$):

*

*$F$ has unique median $\mathrm{med}(X)$ such that $P(X = \mathrm{med}(X)) = 0$;

*$F$ is symmetric about $\mathrm{med}(X)$;

*Expectation $\mathrm{E}[X]$ exists.

So, if these assumptions are met then $\mathrm{med}(X) = \mathrm{E}[X]$ and the hypotheses of the one-sample Wilcoxon signed-rank test are the following (for the two-sided alternative):
$\quad\begin{aligned}H_0: ~\mathrm{med}(X) = 0 \\ H_1: ~\mathrm{med}(X) \neq 0 \end{aligned} \qquad \iff \qquad \begin{aligned}\widetilde{H_0}: ~\mathrm{E}[X] = 0 \\ \widetilde{H_1}: ~\mathrm{E}[X] \neq 0 \end{aligned}$
Next, I tried to use the fact that paired Wilcoxon signed-rank test is just a special case of its one sample version (if we have paired samples $(X_1,\ldots,X_n) \overset{\text{iid}}{\sim} F_1$ and $(Y_1, \ldots, Y_n) \overset{\text{iid}}{\sim} F_2$, we just need to replace $X$ by difference $X - Y$ in the aforementioned formulas), and got the following.
Assumptions for the paired Wilcoxon signed-rank test:

*

*Distribution of $X - Y$ has unique median $\mathrm{med}(X-Y)$ such that $P(X - Y = \mathrm{med}(X-Y)) = 0$;

*Distribution of $X - Y$ is symmetric about $\mathrm{med}(X-Y)$;

*Expectation $\mathrm{E}[X-Y]$ exists.

If these assumptions are met then $\mathrm{med}(X-Y) = \mathrm{E}[X-Y]$ and the hypotheses of the paired Wilcoxon signed-rank test are the following (for the two-sided alternative):
$\quad\begin{aligned}H_0: ~\mathrm{med}(X-Y) = 0 \\ H_1: ~\mathrm{med}(X-Y) \neq 0 \end{aligned} \qquad \iff \qquad \begin{aligned}\widetilde{H_0}: ~\mathrm{E}[X-Y] = 0 \\ \widetilde{H_1}: ~\mathrm{E}[X-Y] \neq 0 \end{aligned}$
This all seems fine but one thing confuses me: expectation is a linear operator, so we can rewrite $\widetilde{H_0}$ and $\widetilde{H_1}$ as $\widetilde{H_0}: \mathrm{E}[X] = \mathrm{E}[Y]$ and $\widetilde{H_1}: \mathrm{E}[X] \neq \mathrm{E}[Y]$ respectively. But population median is not a linear operator, hence we can't rewrite $H_0$ and $H_1$ as $H_0: \mathrm{med}(X) = \mathrm{med}(Y)$ and $H_1: \mathrm{med}(X) \neq \mathrm{med}(Y)$ respectively.
In other words, paired Wilcoxon signed-rank test (if the aforementioned assumptions are met) is a test for comparing the means of the paired samples, but it is not a test for comparing the medians of the paired samples. Is this conclusion right or wrong?

P.S. There is a post on SSE on similar topic, it claims that paired Wilcoxon signed-rank test can be a test of median difference (or mean difference) only if two fairly strict assumptions are met:

*

*The distribution of both groups must have the same shape.


*The variance of both groups must be equal.
These assumptions seem strange for me because, as far as I know, paired Wilcoxon signed-rank test is just a special case of its one-sample version. And I didn't met these two assumptions in other sources (I saw these assumptions in requirements for the Mann–Whitney U test but not for the Wilcoxon signed-rank test).
 A: The one-sample signed-rank test is, precisely, a test for the median pairwise mean. That is, we can define pairwise means $\Delta_{ij}=(X_i+X_j)/2$, and the test statistic has its minimum value when the median of $\Delta$ is zero. As sample size increases, the test will eventually reject for any distribution where $med[\Delta]\neq 0$.
If the distribution is symmetric and the mean of $X$ exists, the median of $\Delta$ and the mean of $X$ and the median of $X$ are all the same; they are all the centre of symmetry. In that special case, the test is also a test for the median of $X$ and for the mean of $X$, because they are all the same.   If the distribution is not symmetric, they are typically all different and the test is not a test for the mean of $X$ or the median of $X$.
Going on to paired tests, if $X_i=Y_i-Z_i$ then the test is still for the median pairwise difference fo $X_i$, and is for the mean or median of $X$ under the same assumptions as before. These are your second set of assumptions. Precisely because the median is not a linear functional, it takes additional assumptions for a test of the median to also be a test of the mean.
And finally, the situation for the Wilcoxon rank-sum test is very different.  There is no one-sample summary statistic analogous to $med(\Delta)$ that the Wilcoxon rank-sum test is a test for (without additional assumptions).  In fact, there is no ordering on all distributions that agrees with the Wilcoxon rank-sum test.  It's possible to have three variables $X$, $Y$, $Z$ such that the Wilcoxon test thinks $X$ is bigger than $Y$, $Y$ is bigger than $Z$, and $Z$ is bigger than $X$.
However, if you make additional assumptions, such as the two distributions being the same except for a shift in location, then  the Wilcoxon test is a test for means or for medians -- if two distributions are the same except for a shift in location then they can differ only if they have different means and only if they have different medians.
