# Using \input{} in inline mathmode -- extra }

I generate certain values and print them in single .tex-files (example.tex) in python, mostly in the form \SI{<value>}{\percent} or as single lines for tabular environments & \SI{<value>}{\percent} & \SI{<value>}{\percent} & \SI{<value>}{\percent}.

However, I can easily use \input{example.tex} to include this value in normal text,align or tabular environments without any trouble. But when using it within a mathmode (, , \ensuremath) of a table caption, the log files yields "...an extra }" at the place of input.

Pdflatex compiles and the value shows up, bit since the warning is an error, Id like to ask either:

1) Is the use of \input{} for this purpose generally recommended?
2) How to get rid of the error/what did I do wrong?

Below an MWE, test_size.tex consists purely of \SI{30}{\percent}.

\documentclass{article}

\usepackage{siunitx}
\usepackage{amsmath}

\begin{document}
Normal inline mode works: \input{./values/test_size.tex}\\[1ex]
Normal math inline mode works: $\input{./values/test_size.tex}$
\begin{table}
\caption{Math inline caption doesnt work: $\input{./values/test_size.tex}$}
\end{table}
\begin{align}
\textrm{align enviroment works: } \input{./values/test_size.tex}
\end{align}
\end{document}

EDIT: This would have helped as well. Sorry for double posting.