change assertion to ValueError