A few months ago, nobody imagined that Bernie Sanders could give Hillary Clinton a meaningful challenge in her home state. But on April 19, the two will square off in a competitive Democratic primary that will test the ideals of the party’s left against its more centrist impulses.

Mr. Sanders remains a long shot for the nomination, but he has cut Mrs. Clinton’s lead in New York. Mr. Sanders has won six states in a row and is expected to win the Democratic caucuses in Wyoming on Saturday. In March, he raised a record $44 million, beating Mrs. Clinton’s monthly total ($29.5 million) for the third month in a row.

The Democratic Party benefits from this energized race. The debates, dueling speeches and media analyses have highlighted important differences between the candidates and provided voters with insights into how both Mrs. Clinton and Mr. Sanders hold up under scrutiny.

Mr. Sanders has been pressed to provide details on how he would “break up” big banks and pay for free public college tuition and universal health care, and he has faced tough questions on whether his calls to “revolution” can succeed without foot soldiers in Congress. Mrs. Clinton has been questioned on her plans to regulate banks and big industries that have given her millions in donations and speaking fees, and grilled on the legality of using a private server in her home to handle federal government email.