Exemplo n.º 1
0
    def __init__(self, conditionals, klass, auto_select=True, *args, **kw):
        if not klass:
            raise NotImplementedError

        if conditionals:
            for ci in conditionals:
                cx = ci if isinstance(ci, BaseConditional) else conditional_from_dict(ci, klass)
                if cx:
                    self.conditionals.append(cx)
        if auto_select:
            if self.conditionals:
                self.selected = self.conditionals[0]
            else:
                self.selected = klass('', 0)
                self.conditionals = [self.selected]

        self._conditional_klass = klass
        super(ConditionalGroup, self).__init__(*args, **kw)
Exemplo n.º 2
0
    def __init__(self, conditionals, klass, *args, **kw):
        if not klass:
            raise NotImplementedError

        if conditionals:
            for ci in conditionals:
                cx = conditional_from_dict(ci, klass)
                if cx:
                    self.conditionals.append(cx)

        if self.conditionals:
            self.selected = self.conditionals[0]
        else:
            self.selected = klass('', '')
            self.conditionals = [self.selected]

        self._conditional_klass = klass
        super(ConditionalGroup, self).__init__(*args, **kw)
Exemplo n.º 3
0
    def __init__(self, conditionals, klass, auto_select=True, *args, **kw):
        if not klass:
            raise NotImplementedError

        if conditionals:
            for ci in conditionals:
                cx = ci if isinstance(
                    ci, BaseConditional) else conditional_from_dict(ci, klass)
                if cx:
                    self.conditionals.append(cx)
        if auto_select:
            if self.conditionals:
                self.selected = self.conditionals[0]
            else:
                self.selected = klass('', 0)
                self.conditionals = [self.selected]

        self._conditional_klass = klass
        super(ConditionalGroup, self).__init__(*args, **kw)
Exemplo n.º 4
0
 def _test(self, d, expected=True, kind='TerminationConditional'):
     c = conditional_from_dict(d, kind)
     ret = c.check(self.arun, ([], []), 1000)
     self.assertEqual(ret, expected)
Exemplo n.º 5
0
 def _test(self, d, expected=True, kind='TerminationConditional'):
     c = conditional_from_dict(d, kind)
     ret = c.check(self.arun, ([], []), 1000)
     self.assertEqual(ret, expected)