Commits

mattip  committed dfc4733 Merge

merge heads

  • Participants
  • Parent commits 3073d4f, 6f159a1

Comments (0)

Files changed (3)

File pypy/module/micronumpy/test/test_numarray.py

         b = array(a, dtype='d')
         assert a.dtype is b.dtype
 
+    def test_notequal_different_shapes(self):
+        from _numpypy import array
+        a = array([1, 2])
+        b = array([1, 2, 3, 4])
+        assert (a == b) == False
+
 
 class AppTestMultiDim(BaseNumpyAppTest):
     def test_init(self):

File rpython/rlib/test/test_timer.py

-from rpython.rlib.timer import Timer
-from rpython.translator.c.test.test_genc import compile
-from rpython.annotator.policy import AnnotatorPolicy
-
-
-t = Timer()
-t.start("testc")
-t.stop("testc")
-
-def timer_user():
-    assert "testc" not in t.timingorder
-    t.start("testa")
-    t.stop("testa")
-    t.start("testb")
-    t.start("testb")
-    t.stop("testb")
-    t.stop("testb")
-    t.start_name("test", "one")
-    t.stop_name("test", "one")
-    t.dump()
-
-
-def test_compile_timer():
-    policy = AnnotatorPolicy()
-    f_compiled = compile(timer_user, [], annotatorpolicy=policy)
-    f_compiled()

File rpython/rlib/timer.py

-import time
-import os
-
-
-def _create_name(name, generation):
-    if generation == 0:
-        return name
-    else:
-        return "%s[%s]" % (name, str(generation))
-
-
-class Timer:
-    def __init__(self):
-        self.reset()
-
-    def reset(self):
-        self.timings = {}
-        self.levels = {}
-        self.timingorder = []
-
-    def _cleanup_(self):
-        self.reset()
-
-    def start(self, timer):
-        level = self.levels.setdefault(timer, -1)
-        new_level = level + 1
-        name = _create_name(timer, new_level)
-        if name not in self.timings:
-            self.timingorder.append(name)
-        self.timings[name] = time.time() - self.timings.get(name, 0)
-        self.levels[timer] = new_level
-
-    def start_name(self, timerone, timertwo):
-        self.start(timerone + " " + timertwo)
-
-    def stop(self, timer):
-        level = self.levels.setdefault(timer, -1)
-        if level == -1:
-            raise ValueError("Invalid timer name")
-        if level >= 0: # timer is active
-            name = _create_name(timer, level)
-            self.timings[name] = time.time() - self.timings[name]
-            self.levels[timer] = level - 1
-
-    def stop_name(self, timerone, timertwo):
-        self.stop(timerone + " " + timertwo)
-
-    def value(self, timer):
-        level = self.levels.get(timer, -1)
-        if level == -1:
-            result = "%fs" % self.timings[timer]
-        else:
-            result = "%fs (still running)" % (time.time() - self.timings[timer])
-        return result
-
-    def dump(self):
-        outlist = []
-        for timer in self.timingorder:
-            value = self.value(timer)
-            outlist.append("%s = %s" % (timer, value))
-        os.write(2, "\n".join(outlist))
-
-
-class DummyTimer:
-    def start(self, timer):
-        pass
-    def start_name(self, timerone, timertwo):
-        pass
-    def stop(self, timer):
-        pass
-    def stop_name(self, timerone, timertwo):
-        pass
-    def value(self, timer):
-        return "Timing disabled"
-    def dump(self):
-        pass
-