I am confused with the difference between z-test and chi square test.
In book Agresti 2007 An introduction to categorical data analysis, page 9, the author had an example of testing
Do a majority or minority of adults in US believe that a pregnant woman should be able to obtain an abortion.
The data is 400 "yes" and 493 "no" in a "yes or no" survey question. And want to test if $\pi=0.5$, where observed/empirical ratio $p=0.448$
The author uses a z-test, where
$z=(0.448-0.5)/\sqrt{0.5*0.5/893}=-3.1$
But should we use chi-square goodness of fit test where we comparing observed with theoretical distribution ($\pi=0.5$)? It seems they are the same in this case. Why?