[Zope-Checkins] SVN: Zope/trunk/lib/python/reStructuredText/tests/testReST.py some more tests for csv-table directive
Log message for revision 69287: some more tests for csv-table directive Changed: U Zope/trunk/lib/python/reStructuredText/tests/testReST.py -=- Modified: Zope/trunk/lib/python/reStructuredText/tests/testReST.py === --- Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-07-28 19:14:25 UTC (rev 69286) +++ Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-07-29 12:29:16 UTC (rev 69287) @@ -108,6 +108,20 @@ source = '.. raw:: html\n :url: http://www.zope.org' self.assertRaises(NotImplementedError, HTML, source) + +def test_csv_table_file_option_raise(self): + +source = '.. csv-table:: \n :file: inclusion.txt' +result = HTML(source) +self.failUnless('File and URL access deactivated' in result) + +def test_csv_table_file_option_raise(self): + +source = '.. csv-table:: \n :url: http://www.evil.org' +result = HTML(source) +self.failUnless('File and URL access deactivated' in result) + + def test_suite(): from unittest import TestSuite, makeSuite return TestSuite((makeSuite(TestReST),)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py more tests for csv-table directive
Log message for revision 69288: more tests for csv-table directive Changed: U Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py -=- Modified: Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py === --- Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py2006-07-29 12:29:16 UTC (rev 69287) +++ Zope/trunk/lib/python/Products/ZReST/tests/test_ZReST.py2006-07-29 12:42:49 UTC (rev 69288) @@ -5,6 +5,7 @@ $Id$ import unittest +import tempfile txt = Hello World @@ -20,6 +21,11 @@ + +csv_text = bin:x:1:1:bin:/bin:/bin/bash +daemon:x:2:2:Daemon:/sbin:/bin/bash + + class TestZReST(unittest.TestCase): def _getTargetClass(self): @@ -29,6 +35,11 @@ def _makeOne(self, id='test', *args, **kw): return self._getTargetClass()(id=id, *args, **kw) +def _csvfile(self): +fn = tempfile.mktemp() +open(fn, 'w').write(csv_text) +return fn + def test_empty(self): empty = self._makeOne() @@ -91,6 +102,24 @@ self.assertRaises(NotImplementedError, resty.render) +def test_csv_table_file_option_raise(self): + +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :file: %s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/file directive is not disabled!') + +def test_csv_table_url_option_raise(self): +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :url: file://%s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/url directive is not disabled!') + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestZReST)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/lib/python/reStructuredText/tests/testReST.py fixed nameclash
Log message for revision 69289: fixed nameclash Changed: U Zope/trunk/lib/python/reStructuredText/tests/testReST.py -=- Modified: Zope/trunk/lib/python/reStructuredText/tests/testReST.py === --- Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-07-29 12:42:49 UTC (rev 69288) +++ Zope/trunk/lib/python/reStructuredText/tests/testReST.py2006-07-29 12:55:25 UTC (rev 69289) @@ -115,7 +115,7 @@ result = HTML(source) self.failUnless('File and URL access deactivated' in result) -def test_csv_table_file_option_raise(self): +def test_csv_table_url_option_raise(self): source = '.. csv-table:: \n :url: http://www.evil.org' result = HTML(source) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/ more tests for csv-table directive
Log message for revision 69290: more tests for csv-table directive Changed: U Zope/branches/2.9/lib/python/Products/ZReST/tests/test_ZReST.py U Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py -=- Modified: Zope/branches/2.9/lib/python/Products/ZReST/tests/test_ZReST.py === --- Zope/branches/2.9/lib/python/Products/ZReST/tests/test_ZReST.py 2006-07-29 12:55:25 UTC (rev 69289) +++ Zope/branches/2.9/lib/python/Products/ZReST/tests/test_ZReST.py 2006-07-29 12:59:31 UTC (rev 69290) @@ -3,7 +3,13 @@ $Id$ import unittest +import tempfile + +csv_text = bin:x:1:1:bin:/bin:/bin/bash +daemon:x:2:2:Daemon:/sbin:/bin/bash + + class TestZReST(unittest.TestCase): def _getTargetClass(self): @@ -13,6 +19,11 @@ def _makeOne(self, id='test', *args, **kw): return self._getTargetClass()(id=id, *args, **kw) +def _csvfile(self): +fn = tempfile.mktemp() +open(fn, 'w').write(csv_text) +return fn + def test_empty(self): empty = self._makeOne() @@ -59,6 +70,24 @@ resty.source = '.. raw:: html\n :url: http://www.zope.org/' self.assertRaises(NotImplementedError, resty.render) +def test_csv_table_file_option_raise(self): + +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :file: %s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/file directive is not disabled!') + +def test_csv_table_url_option_raise(self): +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :url: file://%s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/url directive is not disabled!') + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestZReST)) Modified: Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py === --- Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py 2006-07-29 12:55:25 UTC (rev 69289) +++ Zope/branches/2.9/lib/python/reStructuredText/tests/testReST.py 2006-07-29 12:59:31 UTC (rev 69290) @@ -52,6 +52,18 @@ source = '.. raw:: html\n :url: http://www.zope.org' self.assertRaises(NotImplementedError, HTML, source) +def test_csv_table_file_option_raise(self): + +source = '.. csv-table:: \n :file: inclusion.txt' +result = HTML(source) +self.failUnless('directive disabled' in result) + +def test_csv_table_url_option_raise(self): + +source = '.. csv-table:: \n :url: http://www.evil.org' +result = HTML(source) +self.failUnless('directive disabled' in result) + def test_suite(): from unittest import TestSuite, makeSuite return TestSuite((makeSuite(TestReST),)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/reStructuredText/tests/testReST.py more tests for csv-table directive
Log message for revision 69291: more tests for csv-table directive Changed: U Zope/branches/2.10/lib/python/reStructuredText/tests/testReST.py -=- Modified: Zope/branches/2.10/lib/python/reStructuredText/tests/testReST.py === --- Zope/branches/2.10/lib/python/reStructuredText/tests/testReST.py 2006-07-29 12:59:31 UTC (rev 69290) +++ Zope/branches/2.10/lib/python/reStructuredText/tests/testReST.py 2006-07-29 13:34:59 UTC (rev 69291) @@ -108,6 +108,20 @@ source = '.. raw:: html\n :url: http://www.zope.org' self.assertRaises(NotImplementedError, HTML, source) + +def test_csv_table_file_option_raise(self): + +source = '.. csv-table:: \n :file: inclusion.txt' +result = HTML(source) +self.failUnless('File and URL access deactivated' in result) + +def test_csv_table_file_option_raise(self): + +source = '.. csv-table:: \n :url: http://www.evil.org' +result = HTML(source) +self.failUnless('File and URL access deactivated' in result) + + def test_suite(): from unittest import TestSuite, makeSuite return TestSuite((makeSuite(TestReST),)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Products/ZReST/tests/test_ZReST.py more tests for csv-table directive
Log message for revision 69292: more tests for csv-table directive Changed: U Zope/branches/2.10/lib/python/Products/ZReST/tests/test_ZReST.py -=- Modified: Zope/branches/2.10/lib/python/Products/ZReST/tests/test_ZReST.py === --- Zope/branches/2.10/lib/python/Products/ZReST/tests/test_ZReST.py 2006-07-29 13:34:59 UTC (rev 69291) +++ Zope/branches/2.10/lib/python/Products/ZReST/tests/test_ZReST.py 2006-07-29 13:35:45 UTC (rev 69292) @@ -5,6 +5,7 @@ $Id$ import unittest +import tempfile txt = Hello World @@ -20,6 +21,11 @@ + +csv_text = bin:x:1:1:bin:/bin:/bin/bash +daemon:x:2:2:Daemon:/sbin:/bin/bash + + class TestZReST(unittest.TestCase): def _getTargetClass(self): @@ -29,6 +35,11 @@ def _makeOne(self, id='test', *args, **kw): return self._getTargetClass()(id=id, *args, **kw) +def _csvfile(self): +fn = tempfile.mktemp() +open(fn, 'w').write(csv_text) +return fn + def test_empty(self): empty = self._makeOne() @@ -91,6 +102,24 @@ self.assertRaises(NotImplementedError, resty.render) +def test_csv_table_file_option_raise(self): + +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :file: %s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/file directive is not disabled!') + +def test_csv_table_url_option_raise(self): +resty = self._makeOne() +csv_file = self._csvfile() +resty.source = '.. csv-table:: \n :url: file://%s' % csv_file +result = resty.render() +self.failUnless('daemon' not in result, +'csv-table/url directive is not disabled!') + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestZReST)) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
Re: [Zope-Checkins] Re: [Checkins] SVN: Products.Five/trunk/ Now you can use the old registry with the new API for registerig components.
Florent Guillaume wrote: Indeed :) On 29 Jul 2006, at 00:39, Benji York wrote: Florent Guillaume wrote: On 27 Jul 2006, at 16:15, Lennart Regebro wrote: Modified: Products.Five/trunk/site/localsite.py === --- Products.Five/trunk/site/localsite.py2006-07-27 13:51:25 UTC (rev 69270) +++ Products.Five/trunk/site/localsite.py2006-07-27 14:15:46 UTC (rev 69271) @@ -16,12 +16,26 @@ $Id$ +from operator import xor +def one_of_three(a, b, c): +# Logical table for a three part test where only one can be true: +# 0 0 0: 0 +# 0 0 1: 1 +# 0 1 0: 1 +# 0 1 1: 0 +# 1 0 0: 1 +# 1 0 1: 0 +# 1 1 0: 0 +# 1 1 1: 0 +return xor(xor(a, b), c) and not (a and b and c) Heh, boolean algebra is nice but sometimes integers convey the meaning much better: return int(a)+int(b)+int(c) == 1 Hey, this is fun! How about this: def only_one(*args): return sum(bool(i) for i in args) == 1 --Benji York Senior Software Engineer Zope Corporation or even: [a, b, c].count(True) == 1 :-) /JM ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins