Mystery Plant

I have a weed in one of my containers that I can’t identify. I don’t want to kill it because I’m fascinated with the plant. At first I thought it was a pepper or tomato, but it doesn’t seem to be one.

The plant is about a foot and a half in height and has leaves that resemble a pepper or tomato leaf. It has round green fruits that look like a tomato, but is only about 1/4 inch round and turns to a dark purple (almost black).

Photo 1
1. The fruits above are about 1/4 inch round and turn a dark purple (almost black).

Photo 2
2. This is a similar plant I saw in an empty lot in San Francisco. Same fruits, but the leaves are slightly different from the one I have at home.

Can anyone identify these plants? Thank you.

Also posted in gardening, entry: 671525