class IQN(str): """ A string subclass that validates values with the IQNValidator """ _validator = IQNValidator() def __new__(mcls, value): problem = mcls._validator(None, value) if problem: raise ValueError(problem) return super().__new__(mcls, value)
def setUp(self): self.validator = IQNValidator() self.variable = None