Denise, I understand why you want to ask the question because I felt the same way. I wanted to ask the question because I wanted to know if I really did pass. And you know what? I did ask. Here's what happened: I joined several social groups and eventually became good friends with a few women. We ended up meeting for lunch or dinner several times, just the two of us. We got to know each other, talking for hours about all kinds of things. We spent time together on outings to like the museum or whatever. And it was usually in a one-on-one friends situation, so that we could get to know each other better.
After a while, I asked each of them separately and privately if they knew I was trans. They were each very surprised and had no idea. They thought I was just another woman like them. It really boosted my confidence to know that I passed, even after many conversations and time spent with them. And you know what else? Our friendships became stronger because I shared a vulnerable part of myself. They accepted me completely and we're still good friends to this day.
But for your specific situation, I'm not so sure I would ask. For two reasons. First, you took a class with them. You didn't really spend a lot of time with them. If you really want to know if you truly and fully pass, you want to ask the question after you spend a lot of time socializing with them. Because in my opinion, the true test of passing is social, not physical.
Second reason, you were in a locker room with the other woman already. It might make her feel very uncomfortable and awkward if she knows that you were transgender and possibly pre-op and all this time she was in the locker room with you. A lot of cis people support trans people, but when it comes to the locker room issue, they take a harder stance. It's better if they don't know.
So yes, I encourage you to ask the question as it may help you as it did me, but try to set up another scenario where you can do it. Because of the reasons I explained above, I would not do it in this case.