tikz and beamer: shape rectangle split example from manual

The #1 seems to cause a problem. However, it can be fixed using the fragile option to the frame, which is described in the beamer manual, and causes the frame content to be differently handled.

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\begin{document}
\begin{frame}[fragile]{Testing}
  \begin{tikzpicture}[my shape/.style={ rectangle split,
    rectangle split parts=#1, draw, anchor=center}]
    \node [my shape=5] at (0,1) {
      a\nodepart{two}b\nodepart{three}c\nodepart{four}d\nodepart{five}e};
    \node [my shape=5, rectangle split horizontal] at (2,2) {
      1\nodepart{two}2\nodepart{three}3\nodepart{four}4\nodepart{five}5};
    \node [my shape=3] at (3,0.5) {
      A\nodepart{two}B\nodepart{three}C};
    \node [my shape=4, rectangle split horizontal] at (1.5,0.5) {
      1\nodepart{two}2\nodepart{three}3\nodepart{four}4};
  \end{tikzpicture}
\end{frame}
\end{document}

test frame