Exemplo n.º 1
0
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)
Exemplo n.º 2
0
 def setUp(self):
     self.validator = IQNValidator()
     self.variable = None