By happy coincidence, Cobie Smulders (How I Met Your Mother, Avengers: Age of Ultron) actually was pregnant while shooting Unexpected - a gentle, thoughtful, if sometimes naive drama about a 30-year-old Chicago public-school teacher who goes through her first pregnancy with the help and love of a teenage student who also has become pregnant.

It's obvious this piece of kismet helped. Smulders veritably glows as Samantha Abbott, a science teacher who ups and marries her live-in boyfriend, John (Anders Holm), days after she learns the unexpected news from a home pregnancy test.

Sam is about to lose her job - her impoverished inner-city school is being shuttered - so she and John decide she'll try her hand at being a stay-at-home mom.

While she seems to get nothing but support from John, Sam remains uncertain of her decision, especially when her well-to-do mom (Elizabeth McGovern) reminds her she's giving up a master's degree and a chance to land a better job.

The third feature helmed by actor, writer, director - and former Chicago high school teacher - Kris Williams Swanberg, Unexpected offers an equally impressive performance by relative newcomer Gail Bean (Estrogen, The Special Project) as one of Samantha's brightest students, Jasmine.

Unexpected falters when it comes to Jasmine, who seems to be constructed out of movie cliches. An African American high school senior with a 3.8 GPA who is clearly bound for college, Jasmine has the requisite inner-city backstory. Born to a junkie mom, Jasmine and her two younger siblings were raised by their grandmother, who barely makes ends meet on welfare.

Yet, when the teen learns she's pregnant, she decides without much reflection to keep the baby. Sam makes a point of not influencing Jasmine's decision, but she comes off as patronizing, nonetheless.

Most of the film is composed of cheerful scenes of the two expectant mothers sharing meals, sharing a yoga teacher, or at work on Jasmine's college applications.

Unexpected has great charm: The chemistry between Smulders and Bean is simply terrific. Their performances almost save the film from its earnest, if bumbling, attempts to make a statement about the social, economic, and racial differences that divide the two characters.