fix tests.

it seems that `if not segment` and `if segment != ''` do not do the same
thing.