Commits

Carl Friedrich Bolz committed 539fbad

(arigo, cfbolz): test and fix

Comments (0)

Files changed (2)

pypy/annotation/test/test_annrpython.py

         assert isinstance(s2.dictdef.dictkey.  s_value, annmodel.SomeInteger)
         assert isinstance(s2.dictdef.dictvalue.s_value, annmodel.SomeInteger)
 
+    def test_not_dict(self):
+        def f(x):
+            d = {x: x}
+            return not d
+        a = self.RPythonAnnotator()
+        s = a.build_types(f, [str])
+        assert isinstance(s, annmodel.SomeBool)
+
     def test_pbc_union(self):
         class A:
             def meth(self):

pypy/annotation/unaryop.py

         knowntypedata = r.knowntypedata = {}
         fn, block, i = bk.position_key
         op = block.operations[i]
-        assert op.opname == "is_true" or op.opname == "nonzero"
+        assert op.opname in ["is_true", "nonzero", "is_false"]
         assert len(op.args) == 1
         arg = op.args[0]
         s_nonnone_obj = s_obj