예제 #1
0
파일: state_test.py 프로젝트: runt18/pytype
 def test_none_restricted(self):
     x = self.new_binding("x")
     y = self.new_binding("y")
     c = state._restrict_condition(self._node, self._parent, [x, y], False)
     self.assertIs(self._parent, c)
     c = state._restrict_condition(self._node, self._parent, [x, y], True)
     self.assertIs(self._parent, c)
예제 #2
0
 def test_some_restricted_with_parent(self):
   x = self.new_binding()  # Can be true or false.
   y = self.new_binding(ONLY_FALSE)
   z = self.new_binding()  # Can be true or false.
   c = state._restrict_condition(self._node, [x, y, z], True)
   self.check_binding("x=? | z=?", c.binding,
                      x=x, y=y, z=z)
예제 #3
0
파일: state_test.py 프로젝트: runt18/pytype
 def test_some_restricted_no_parent(self):
     x = self.new_binding("x")  # Can be true or false.
     y = self.new_binding("y", ONLY_FALSE)
     z = self.new_binding("z")  # Can be true or false.
     c = state._restrict_condition(self._node, None, [x, y, z], True)
     self.assertIsNone(c.parent)
     self.check_binding("x=? | z=?", c.binding)
예제 #4
0
파일: state_test.py 프로젝트: runt18/pytype
 def test_some_restricted_with_parent(self):
     x = self.new_binding("x")  # Can be true or false.
     y = self.new_binding("y", ONLY_FALSE)
     z = self.new_binding("z")  # Can be true or false.
     c = state._restrict_condition(self._node, self._parent, [x, y, z],
                                   True)
     self.assertIs(self._parent, c.parent)
     self.check_binding("__split=None x=? | __split=None z=?", c.binding)
예제 #5
0
파일: state_test.py 프로젝트: runt18/pytype
 def test_restricted_to_dnf(self):
     # DNF for a | (b & c)
     dnf = [[self.new_binding("a")],
            [self.new_binding("b"),
             self.new_binding("c")]]
     x = self.new_binding("x")  # Compatible with everything
     y = self.new_binding("z", FakeValue("DNF", dnf,
                                         False))  # Reduce to dnf
     c = state._restrict_condition(self._node, None, [x, y], True)
     self.assertIsNone(c.parent)
     self.check_binding("a=? | b=? c=? | x=?", c.binding)
예제 #6
0
 def test_restricted_to_dnf(self):
   # DNF for a | (b & c)
   a = self.new_binding()
   b = self.new_binding()
   c = self.new_binding()
   dnf = [[a],
          [b, c]]
   x = self.new_binding()  # Compatible with everything
   y = self.new_binding(FakeValue("DNF", dnf, False))  # Reduce to dnf
   cond = state._restrict_condition(self._node, [x, y], True)
   self.check_binding("a=? | b=? c=? | x=?", cond.binding,
                      a=a, b=b, c=c, x=x, y=y)
예제 #7
0
 def test_all_restricted(self):
   x = self.new_binding(ONLY_FALSE)
   y = self.new_binding(ONLY_FALSE)
   c = state._restrict_condition(self._node, [x, y], True)
   self.assertIs(state.UNSATISFIABLE, c)
예제 #8
0
 def test_none_restricted(self):
   x = self.new_binding()
   y = self.new_binding()
   state._restrict_condition(self._node, [x, y], False)
   state._restrict_condition(self._node, [x, y], True)
예제 #9
0
 def test_no_bindings(self):
   c = state._restrict_condition(self._node, [], False)
   self.assertIs(state.UNSATISFIABLE, c)
   c = state._restrict_condition(self._node, [], True)
   self.assertIs(state.UNSATISFIABLE, c)