From: <fwi...@us...> - 2009-08-10 17:32:56
|
Revision: 6649 http://jython.svn.sourceforge.net/jython/?rev=6649&view=rev Author: fwierzbicki Date: 2009-08-10 17:32:50 +0000 (Mon, 10 Aug 2009) Log Message: ----------- Trivial reindents. Modified Paths: -------------- trunk/jython/Lib/test/regrtest.py trunk/jython/Lib/test/test_java_list_delegate.py trunk/jython/Lib/test/test_jy_internals.py trunk/jython/Lib/test/test_timeit.py Modified: trunk/jython/Lib/test/regrtest.py =================================================================== --- trunk/jython/Lib/test/regrtest.py 2009-08-10 17:24:15 UTC (rev 6648) +++ trunk/jython/Lib/test/regrtest.py 2009-08-10 17:32:50 UTC (rev 6649) @@ -1577,7 +1577,7 @@ print >>f," ]" finally: f.close() - + if __name__ == '__main__': # Remove regrtest.py's own directory from the module search path. This # prevents relative imports from working, and relative imports will screw Modified: trunk/jython/Lib/test/test_java_list_delegate.py =================================================================== --- trunk/jython/Lib/test/test_java_list_delegate.py 2009-08-10 17:24:15 UTC (rev 6648) +++ trunk/jython/Lib/test/test_java_list_delegate.py 2009-08-10 17:32:50 UTC (rev 6649) @@ -9,10 +9,10 @@ def _perform_op(self, value, op_func): """ Perform an operation - + value - the value to operate on op_func - the function that applies the operation to value - + Returns: the result of calling op_func, OR the exception that was raised in op_func """ @@ -20,7 +20,7 @@ return op_func(value) except Exception, e: return type(e) - + def check_list(self, control, results, initial): for result in results: try: @@ -34,48 +34,48 @@ def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation - + Ensures that performing an operation on: - a python list - a java.util.List instance - + givens the same result in both cases """ lists = [list(initial_value), ArrayList(initial_value), Vector(initial_value)] - + results = [self._perform_op(l, op_func) for l in lists] self.check_list(lists[0], lists[1:], initial_value) if check_value or not isinstance(results[0], list): for r in results[1:]: - self.assertEquals(results[0], r) + self.assertEquals(results[0], r) else: self.check_list(results[0], results[1:], initial_value) - + def test_get_integer(self): initial_value = range(0, 5) - + for i in xrange(-7, 7): self._list_op_test(initial_value, lambda xs: xs[i], True) def test_set_integer(self): initial_value = range(0, 5) - + def make_op_func(index): def _f(xs): xs[index] = 100 return _f - + for i in xrange(-7, 7): self._list_op_test(initial_value, make_op_func(i), True) def test_set_slice(self): initial_value = range(0, 10) - + def make_op_func(i, j, k, v): def _f(xs): xs[i:j:k] = v return _f - + for i in xrange(-12, 12): for j in xrange(-12, 12): for k in xrange(-12, 12): @@ -86,44 +86,44 @@ def test_del_integer(self): initial_value = range(0,5) - + def make_op_func(index): def _f(xs): del xs[index] return _f - + for i in xrange(-7, 7): self._list_op_test(initial_value, make_op_func(i), True) def test_del_slice(self): initial_value = range(0,10) - + def make_op_func(i, j, k): def _f(xs): del xs[i:j:k] return _f - + for i in xrange(-12, 12): for j in xrange(-12, 12): for k in xrange(-12, 12): self._list_op_test(initial_value, make_op_func(i, j, k), True) - + def test_len(self): jlist = ArrayList() jlist.addAll(range(0, 10)) - + self.assert_(len(jlist) == 10) - + def test_iter(self): jlist = ArrayList() jlist.addAll(range(0, 10)) - + i = iter(jlist) - + x = list(i) - + self.assert_(x == range(0, 10)) - + def test_override_len(self): class MyList (ArrayList): def __len__(self): @@ -131,20 +131,20 @@ m = MyList() m.addAll(range(0,10)) - + self.assert_(len(m) == 11) def test_override_iter(self): class MyList (ArrayList): def __iter__(self): return iter(self.subList(0, self.size() - 1)); - - + + m = MyList() m.addAll(range(0,10)) i = iter(m) x = list(i) - + self.assert_(x == range(0, 9)) def test_override_getsetdelitem(self): @@ -155,21 +155,21 @@ def __setitem__(self, key, value): return self.set(key, value * 2); - + def __delitem__(self, key): self.add(84) m = MyList() m.addAll(range(0,10)) - + self.assert_(m[1] == 2) self.assert_(m.get(1) == 1) - + m[0] = 3 self.assert_(m.get(0) == 6) self.assert_(m[0] == 12) - + del m[0] self.assert_(m.size() == 11) self.assert_(m.get(10) == 84) Modified: trunk/jython/Lib/test/test_jy_internals.py =================================================================== --- trunk/jython/Lib/test/test_jy_internals.py 2009-08-10 17:24:15 UTC (rev 6648) +++ trunk/jython/Lib/test/test_jy_internals.py 2009-08-10 17:32:50 UTC (rev 6649) @@ -97,9 +97,9 @@ assert e[0] == 0 for d in range(8): - for y in [0,255]: - assert float((v+d)*256+y) == sdv(((v+d)*256+y)*256, e) - assert e[0] == 1 + for y in [0,255]: + assert float((v+d)*256+y) == sdv(((v+d)*256+y)*256, e) + assert e[0] == 1 class ExtraMathTests(unittest.TestCase): def test_epsilon(self): @@ -198,7 +198,7 @@ self = frame.f_locals[frame.f_code.co_varnames[0]] myclass = self.__class__ if type(myclass) == ClassType: - classname = myclass.__name__ + classname = myclass.__name__ else: classname = None @@ -210,14 +210,14 @@ assert (g[0] == "__main__" or g[0] == "test.test_jy_internals") self.assertEquals(g[1], None) self.assertEquals(g[2], "foo") - + class Bar: def baz(self): g = getinfo() assert (g[0] == "__main__" or g[0] == "test.test_jy_internals") assert (g[1] == "Bar") assert (g[2] == "baz") - + g = getinfo() assert (g[0] == "__main__" or g[0] == "test.test_jy_internals") self.assertEquals(g[1], None) @@ -253,4 +253,3 @@ if __name__ == "__main__": test_main() - Modified: trunk/jython/Lib/test/test_timeit.py =================================================================== --- trunk/jython/Lib/test/test_timeit.py 2009-08-10 17:24:15 UTC (rev 6648) +++ trunk/jython/Lib/test/test_timeit.py 2009-08-10 17:32:50 UTC (rev 6649) @@ -7,7 +7,7 @@ # module in the regrtest class TestTimeit(unittest.TestCase): - + def test_oct(self): timing = timeit.Timer('for i in xrange(10): oct(i)', 'gc.enable()').timeit(number=10000) self.assertTrue(timing > 0.) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |