| Home | Trees | Indices | Help |
|---|
|
|
1 2 # The contents of this file are subject to the Mozilla Public License 3 # (MPL) Version 1.1 (the "License"); you may not use this file except 4 # in compliance with the License. You may obtain a copy of the License 5 # at http://www.mozilla.org/MPL/ 6 # 7 # Software distributed under the License is distributed on an "AS IS" 8 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 # the License for the specific language governing rights and 10 # limitations under the License. 11 # 12 # The Original Code is LEPL (http://www.acooke.org/lepl) 13 # The Initial Developer of the Original Code is Andrew Cooke. 14 # Portions created by the Initial Developer are Copyright (C) 2009-2010 15 # Andrew Cooke (andrew@acooke.org). All Rights Reserved. 16 # 17 # Alternatively, the contents of this file may be used under the terms 18 # of the LGPL license (the GNU Lesser General Public License, 19 # http://www.gnu.org/licenses/lgpl.html), in which case the provisions 20 # of the LGPL License are applicable instead of those above. 21 # 22 # If you wish to allow use of your version of this file only under the 23 # terms of the LGPL License and not to allow others to use your version 24 # of this file under the MPL, indicate your decision by deleting the 25 # provisions above and replace them with the notice and other provisions 26 # required by the LGPL License. If you do not delete the provisions 27 # above, a recipient may use your version of this file under either the 28 # MPL or the LGPL License. 29 30 ''' 31 Tests for the lepl.core.manager module. 32 ''' 33 34 from logging import basicConfig, DEBUG 35 from unittest import TestCase 36 37 from lepl.matchers.derived import Eos 38 from lepl.matchers.core import Literal 39 from lepl.support.lib import LogMixin 40 41 42 # pylint: disable-msg=C0103, C0111, C0301, W0702, C0324, C0102, C0321, W0141, R0201, R0904 43 # (dude this is just a test) 44 4547 ''' 48 The test here takes '****' and divides it amongst the matchers, all of 49 which will take 0 to 4 matches. The number of different permutations 50 depends on backtracking and varies depending on the queue length 51 available. 52 ''' 538555 ''' 56 These show something is happening. Whether they are exactly correct 57 is another matter altogether... 58 ''' 59 #basicConfig(level=DEBUG) 60 # there was a major bug here that made this test vary often 61 # it should now be fixed 62 self.assert_range(3, 'g', [15,1,1,1,3,3,6,6,10,10,10,15], 4) 63 self.assert_range(3, 'b', [15,0,1,1,5,5,5,5,5,5,5,5,5,15], 4) 64 self.assert_range(3, 'd', [15,1,1,3,3,6,6,10,10,10,15], 4)6567 for index in range(len(results)): 68 queue_len = index * multiplier 69 expr = Literal('*')[::direcn,...][n_match] & Eos() 70 expr.config.clear().low_memory(queue_len) 71 matcher = expr.get_match_string() 72 self.assert_count(matcher, queue_len, index, results[index])7375 results = list(matcher('****')) 76 found = len(results) 77 assert found == count, (queue_len, index, found, count)7880 #basicConfig(level=DEBUG) 81 expr = Literal('*')[:,...][3] 82 expr.config.clear().low_memory(5) 83 match = expr.get_match_string()('*' * 4) 84 list(match)
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sun May 13 16:31:11 2012 | http://epydoc.sourceforge.net |