I had 4 rats for almost a year. They were so awesome and I still think of them and miss them so much. I decided to re-home them to a really good home...they needed and deserved more attention then my kids were willing to give them
Anyhow, Sophia was fine with them. She is a very sweet and quiet girl and doesn't have a mean bone in her body. I was very careful about introducing them.
One day I came home and the rat cage was open.

Two of the rats were being very well behaved and stayed in the cage.

I couldn't find the other two at first. Sophia was as calm as could be. There was some wrapping paper shredded in the living room, so I knew the ratties had been in there at some point. Within 2 hours I had found the other two. One of them was climbing on the cage trying to get back in and the other was behind a couch cushion about a foot away from the cage. They are very intelligent animals.
Sophia and the rats had been out together for about 6 hours total. I was really glad it had a happy ending.
So, my thought it this, it probably depends on the Yorkie. This was before we had Peyton....I don't think I'd trust him within 5 feet of a rat. Please use caution and go slowly. Good luck to you.