No, that’s the point: (depth,) is not the same thing as (depth). Try it and see.
When you do it your way, you pass the unit test for one_hot_matrix, but the cell that creates new_y_test throws the following error:
ValueError: Shape must be rank 1 but is rank 0 for '{{node Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](one_hot, Reshape/shape)' with input shapes: [6], [].
That is why new_y_test is not defined: the cell that creates it threw an error. Did you not see that when you looked before?