[Subversion] / PEAK-Rules / test_rules.py  

Log of /PEAK-Rules/test_rules.py

Parent Directory

No default branch
Bookmark a link to HEAD: (view) (download) (as text)


Revision 2773 - (view) (download) (as text) - [select for diffs]
Modified Thu Apr 9 20:29:52 2015 UTC (9 years, 1 month ago) by pje
File length: 27453 byte(s)
Diff to previous 2766
3.3 and 3.4 should now have identical test output to 3.1 and 3.2

Revision 2766 - (view) (download) (as text) - [select for diffs]
Modified Thu Apr 9 17:22:01 2015 UTC (9 years, 1 month ago) by pje
File length: 27447 byte(s)
Diff to previous 2763
Remove unittest deprecation warnings

Revision 2763 - (view) (download) (as text) - [select for diffs]
Modified Thu Apr 9 16:48:23 2015 UTC (9 years, 1 month ago) by pje
File length: 27179 byte(s)
Diff to previous 2762
Change preferred syntax matching to ~~x instead of `x`

Revision 2762 - (view) (download) (as text) - [select for diffs]
Modified Thu Apr 9 16:02:39 2015 UTC (9 years, 1 month ago) by pje
File length: 26027 byte(s)
Diff to previous 2760
Unify exception reprs across 2.x and 3.x so tests work

Revision 2760 - (view) (download) (as text) - [select for diffs]
Modified Sat Apr 4 23:59:08 2015 UTC (9 years, 1 month ago) by pje
File length: 25666 byte(s)
Diff to previous 2758
Fix tests that fail on 3.x because of Py3-removed features

Revision 2758 - (view) (download) (as text) - [select for diffs]
Modified Sat Apr 4 23:11:06 2015 UTC (9 years, 1 month ago) by pje
File length: 25287 byte(s)
Diff to previous 2712
PEAK-Rules tests now run (but don't pass) on Python 3

Revision 2712 - (view) (download) (as text) - [select for diffs]
Modified Wed Oct 17 22:23:27 2012 UTC (11 years, 6 months ago) by pje
File length: 24826 byte(s)
Diff to previous 2707
Workaround for PyPy issue #1292 affecting doctests that display classes

Revision 2707 - (view) (download) (as text) - [select for diffs]
Modified Tue Sep 6 23:38:51 2011 UTC (12 years, 8 months ago) by pje
File length: 24741 byte(s)
Diff to previous 2706
Decompile calls, dictionaries, and tweak some slice formatting

Revision 2706 - (view) (download) (as text) - [select for diffs]
Modified Tue Sep 6 00:27:32 2011 UTC (12 years, 8 months ago) by pje
File length: 24091 byte(s)
Diff to previous 2705
Fix exponentiation operator precedence in decompiler

Revision 2705 - (view) (download) (as text) - [select for diffs]
Modified Tue Sep 6 00:20:18 2011 UTC (12 years, 8 months ago) by pje
File length: 23767 byte(s)
Diff to previous 2704
Deprecate use of 'in' syntax for class/type checking

Revision 2704 - (view) (download) (as text) - [select for diffs]
Modified Mon Sep 5 22:42:39 2011 UTC (12 years, 8 months ago) by pje
File length: 23771 byte(s)
Diff to previous 2700
Rough starting draft of expression decompiler.

All it does right now is basic Python expressions, but the idea is to 
eventually decompile criteria, predicates, etc. so that error messages 
(and other debugging displays) can show them in a compact, user-friendly 
form, without needing to save the original strings they came from (since 
in many cases, they won't actually come from strings!)

Revision 2700 - (view) (download) (as text) - [select for diffs]
Modified Thu Sep 1 01:17:52 2011 UTC (12 years, 8 months ago) by pje
File length: 20919 byte(s)
Diff to previous 2699
Tweak test to cover dotted function name case

Revision 2699 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 31 23:07:53 2011 UTC (12 years, 8 months ago) by pje
File length: 20876 byte(s)
Diff to previous 2681
Allow registering methods for generic functions that aren't imported yet

Revision 2681 - (view) (download) (as text) - [select for diffs]
Modified Thu Aug 19 20:02:05 2010 UTC (13 years, 8 months ago) by pje
File length: 20628 byte(s)
Diff to previous 2680
Fix a problem with ambiguity between (aType,) and (istype(aType),) in 
TypeEngine functions, and add an error message when you define circular 
method precedence rules.

Revision 2680 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 18 05:16:43 2010 UTC (13 years, 8 months ago) by pje
File length: 20437 byte(s)
Diff to previous 2679
Drop superfluous Conjunction subclasses in favor of just using 
Conjunction in the first place.  Classes and NotObjects were a holdover 
from when I thought the right side of a Test would determine what kind 
of operation would be performed and how it would be indexed.

Revision 2679 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 18 05:05:36 2010 UTC (13 years, 8 months ago) by pje
File length: 20425 byte(s)
Diff to previous 2678
Fix broken indexing for "is not" conditions (especially "and"-ed ones)

Revision 2678 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 18 03:10:22 2010 UTC (13 years, 8 months ago) by pje
File length: 20127 byte(s)
Diff to previous 2676
Simplified class indexing strategy so that ABCs and other 2.6+ classes 
using __subclasscheck__/__subclasshook__ should work correctly without
any special treatment.  (The tradeoff is worse worst-case performance
when not-yet-indexed classes are added to rules or seen during
dispatching.)

Revision 2676 - (view) (download) (as text) - [select for diffs]
Modified Tue Aug 17 23:24:15 2010 UTC (13 years, 8 months ago) by pje
File length: 20088 byte(s)
Diff to previous 2673
Fix same-priority method problem

Revision 2673 - (view) (download) (as text) - [select for diffs]
Modified Tue Aug 17 01:25:45 2010 UTC (13 years, 9 months ago) by pje
File length: 19687 byte(s)
Diff to previous 2660
Simplify CriteriaBuilder by moving the actual criterial logic to
exprssionSignature(), leaving just the binding-management and 
meta-function support in the class.  This simplifies some things
for meta-function compilers, since they only have to deal with one
kind of builder now, and they can use expressionSignature to convert
their arguments into conditions instead of expressions, if needed.

(This should also make it easier to implement an @expand_as decorator 
for even simpler, compiler-free meta-functions!)

Revision 2660 - (view) (download) (as text) - [select for diffs]
Modified Thu Aug 12 12:42:54 2010 UTC (13 years, 9 months ago) by pje
File length: 19726 byte(s)
Diff to previous 2576
Begin separating API from core, so that peak.rules main module contains
only stuff you need for *using* GF's, not extending/customizing, and
core only contains stuff that's mutually interdependent w/other core
stuff.  Change imports in doctests to reflect intended usage.

Revision 2576 - (view) (download) (as text) - [select for diffs]
Modified Wed Sep 17 20:23:04 2008 UTC (15 years, 7 months ago) by pje
File length: 19721 byte(s)
Diff to previous 2568
Fix TypeEngine based GF's not handling kwargs correctly when
the type cache misses.  (Reported by Tim Parkin.)

Revision 2568 - (view) (download) (as text) - [select for diffs]
Modified Tue Jul 15 17:09:34 2008 UTC (15 years, 10 months ago) by pje
File length: 19467 byte(s)
Diff to previous 2567
Add a RuleSet.clear() method, and make RuleSet.__iter__
thread-safe, as described in:

http://www.eby-sarna.com/pipermail/peak/2008-July/003004.html


Revision 2567 - (view) (download) (as text) - [select for diffs]
Modified Tue Jul 15 16:58:17 2008 UTC (15 years, 10 months ago) by pje
File length: 19212 byte(s)
Diff to previous 2566
Temporary fix for issubclass() problem reported by Alberto
Valverde, as described here:

http://www.eby-sarna.com/pipermail/peak/2008-July/003003.html

This is just a temporary fix; the always_testable() function
needs to be refactored with some other sort of ordering check.
Or it might be that only isinstance() and identity tests
should be considered re-orderable.  More thought is required
here.

Revision 2566 - (view) (download) (as text) - [select for diffs]
Modified Tue Jul 15 16:49:02 2008 UTC (15 years, 10 months ago) by pje
File length: 18585 byte(s)
Diff to previous 2560
Refactor condition negation by adding negate() GF, dropping
truth mode from builders, and adding an OrElse sequential-or
operator.  This also changed how Truth tests are coded, to use
Value(True, T/F) objects in place of bools (to get rid of the
ambiguity that previously existed).  Value(x, False) objects
no longer have disjuncts, since that was another ambiguity.
These ambiguities meant that you couldn't cleanly take the
disjuncts() of a Test(), which meant you also couldn't negate
a test safely.  We also no longer force Signature() objects
to expand Test disjunctions, as this isn't necessary for
DNF handling.  (Because we're going to grab the disjuncts()
at rule-add time anyway -- eager expansion was an unnecessary
holdover from the way RuleDispatch did things.)  See also:

 http://www.eby-sarna.com/pipermail/peak/2008-July/003000.html

for more background on the reasoning behind these changes.

Revision 2560 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 26 17:43:49 2008 UTC (15 years, 10 months ago) by pje
File length: 18564 byte(s)
Diff to previous 2558
Implement AST pattern -> predicate algorithm

Revision 2558 - (view) (download) (as text) - [select for diffs]
Modified Wed Jun 25 14:55:52 2008 UTC (15 years, 10 months ago) by pje
File length: 18533 byte(s)
Diff to previous 2557
Add more test coverage for "not" type criteria

Revision 2557 - (view) (download) (as text) - [select for diffs]
Modified Wed Jun 25 14:47:38 2008 UTC (15 years, 10 months ago) by pje
File length: 18479 byte(s)
Diff to previous 2556
Fix "not isinstance" criteria, broken by last refactoring due to
inadequate test coverage.  :(

Revision 2556 - (view) (download) (as text) - [select for diffs]
Modified Fri Jun 20 13:56:54 2008 UTC (15 years, 10 months ago) by pje
File length: 18307 byte(s)
Diff to previous 2555
Fix incorrect matching of istype() rules in inheritance

Revision 2555 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 19 22:31:07 2008 UTC (15 years, 10 months ago) by pje
File length: 18258 byte(s)
Diff to previous 2550
Fix botched index refactoring; single inheritance wasn't working
correctly for types that weren't referenced by any rules.

Revision 2550 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 12 00:34:29 2008 UTC (15 years, 11 months ago) by pje
File length: 18017 byte(s)
Diff to previous 2497
Massive overhaul of the indexing system, to simplify custom
indexing and fully support istype() criteria in instance/subclass
nodes.

Revision 2497 - (view) (download) (as text) - [select for diffs]
Modified Sun Feb 10 16:38:50 2008 UTC (16 years, 3 months ago) by pje
File length: 18026 byte(s)
Diff to previous 2489
Move recursion-error test to test_rules

Revision 2489 - (view) (download) (as text) - [select for diffs]
Modified Thu Jan 17 03:33:36 2008 UTC (16 years, 4 months ago) by pje
File length: 17754 byte(s)
Diff to previous 2488
Determine sequence (and therefore definition precedence) at
rule *parsing* time, rather than rule *addition* time.  This
ensures that lexical order holds within class bodies, and
also prevents confusion when a ruleset is populated using
data from other rulesets.  (i.e. rulesets no longer generate
sequence numbers.)  Also, created a ParseContext struct to
simplify the signature of the unwieldy parse_rule() function.

Revision 2488 - (view) (download) (as text) - [select for diffs]
Modified Thu Jan 17 02:57:37 2008 UTC (16 years, 4 months ago) by pje
File length: 17559 byte(s)
Diff to previous 2485
Consolidate Rule and ActionDef types, making it easier
to link rulesets.

Revision 2485 - (view) (download) (as text) - [select for diffs]
Modified Sun Jan 13 21:42:32 2008 UTC (16 years, 4 months ago) by pje
File length: 17580 byte(s)
Diff to previous 2483
When a method is defined in a class body, defer its
registration until the class is finished, and add the
class to the method's criteria.

Revision 2483 - (view) (download) (as text) - [select for diffs]
Modified Sun Jan 13 19:14:08 2008 UTC (16 years, 4 months ago) by pje
File length: 16654 byte(s)
Diff to previous 2482
Fix missing rule for implies(istype,type)

Revision 2482 - (view) (download) (as text) - [select for diffs]
Modified Sun Jan 13 18:27:45 2008 UTC (16 years, 4 months ago) by pje
File length: 16396 byte(s)
Diff to previous 2481
Begin implementation of RuleDispatch emulation API
To use it, use "from peak.rules import dispatch" in
place of importing the dispatch module.  Once you've
imported the module once, other imports from dispatch.*
should work correctly...  unless the API in question
isn't emulated.  Right now, there is no PyProtocols
support (i.e. interfaces don't work), and single-
dispatch functions can't be cloned.

Revision 2481 - (view) (download) (as text) - [select for diffs]
Modified Sun Jan 13 17:26:02 2008 UTC (16 years, 4 months ago) by pje
File length: 12139 byte(s)
Diff to previous 2466
Fix selectivity problems with Truth and ==
comparisons that were ending up with branches==1,
leading to incorrect dispatch trees.  (The number
of branches should never be 1 in a correct index.)

Revision 2466 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 15:19:30 2007 UTC (16 years, 4 months ago) by pje
File length: 12047 byte(s)
Diff to previous 2465
Add function argument names to engine objects (for parsing, etc.)

Revision 2465 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 14:58:42 2007 UTC (16 years, 4 months ago) by pje
File length: 11465 byte(s)
Diff to previous 2464
Fix an ambiguity in intersection rules for conjunctions and
disjunctions, and a problem comparing IsObject pointers and
non-integers.  Add an 'engine' argument to tests_for, so that
predicate engines will be able to turn type tuples into
signatures using their argument info.

Revision 2464 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 06:01:52 2007 UTC (16 years, 4 months ago) by pje
File length: 11464 byte(s)
Diff to previous 2461
Predicate parsing!  Still a lot of loose ends to tie up
before we have full predicate functions, but this is probably
the last major piece; the rest should mostly be integration
and cleanup.

Revision 2461 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 00:31:53 2007 UTC (16 years, 4 months ago) by pje
File length: 9745 byte(s)
Diff to previous 2456
Predicate dispatching, at last!  We don't compile strings yet,
and range dispatching is worse than half the speed of RuleDispatch
with C speedups.  However, most other types of dispatch should be
a good bit faster, and it should be possible to inline more of the
range lookup.

Revision 2456 - (view) (download) (as text) - [select for diffs]
Modified Sun Dec 30 15:32:41 2007 UTC (16 years, 4 months ago) by pje
File length: 4490 byte(s)
Diff to previous 2454
Index reseeding, classic MROs, enhanced "abstract", and 
smart engine recreation (w/unsubscribe).

Revision 2454 - (view) (download) (as text) - [select for diffs]
Modified Sat Dec 29 22:41:23 2007 UTC (16 years, 4 months ago) by pje
File length: 2508 byte(s)
Diff to previous 2426
Ensure that subscribing or unsubscribing an engine from a
ruleset during a notification will not interefere with the
original list of notifications.  Rename ``.func`` attribute
of engines to ``.function``.

Revision 2426 - (view) (download) (as text) - [select for diffs]
Modified Wed Nov 21 19:59:35 2007 UTC (16 years, 5 months ago) by pje
File length: 2009 byte(s)
Diff to previous 2417
Switch to using peak.util.extremes

Revision 2417 - (view) (download) (as text) - [select for diffs]
Modified Sun Nov 11 22:53:44 2007 UTC (16 years, 6 months ago) by pje
File length: 2987 byte(s)
Diff to previous 2313
Prepare for switch from Aspects to AddOns

Revision 2313 - (view) (download) (as text) - [select for diffs]
Modified Sun Jun 24 02:05:15 2007 UTC (16 years, 10 months ago) by pje
File length: 3002 byte(s)
Diff to previous 2310
PEAK-Rules is now as "smart" as RuleDispatch, in that it now
"knows" as much as RuleDispatch does about logical conditions
regarding Python objects, and how to index them efficiently.
The machinery is also better documented (and probably better
tested) than the equivalent bits of RuleDispatch.

Alas, this does not mean that you can actually use Python
expressions for generic function criteria yet, as the actual
tree builder/interpreter hasn't been written.  So we can
evaluate and index expressions, but not build them from an AST
or build/run a dispatch tree from the indexes.  Still, it's
getting *really* close now!

Revision 2310 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 21 03:16:13 2007 UTC (16 years, 10 months ago) by pje
File length: 2982 byte(s)
Diff to previous 2308
Implement indexing for is/not and </>/==/!= conditions, and general
bitmap-based index facility.  (Still needs class indexing to achieve
parity with the comparable parts of RuleDispatch, but it's getting
close.)

Revision 2308 - (view) (download) (as text) - [select for diffs]
Modified Tue Jun 12 04:51:21 2007 UTC (16 years, 11 months ago) by pje
File length: 1213 byte(s)
Diff to previous 2235
Added Aspects (ala PEP 3124) and refactor to use them in place of special
methods.  Refactor indexes to be aspects of an engine.  Improved handling
for the self-referential bootstrapping of the implies() generic function.

Revision 2235 - (view) (download) (as text) - [select for diffs]
Modified Sun Sep 3 19:37:44 2006 UTC (17 years, 8 months ago) by pje
File length: 1196 byte(s)
Diff to previous 2229
Implement bytecode generation for expressions; this is basically 
equivalent to porting a little more than half of ``dispatch.predicates`` 
from RuleDispatch (specifically, the ``ExprBuilder`` class and related 
node types).

Revision 2229 - (view) (download) (as text) - [select for diffs]
Modified Sun Sep 3 01:40:17 2006 UTC (17 years, 8 months ago) by pje
File length: 1165 byte(s)
Diff to previous 2201
Ported ast_builder module from RuleDispatch, with some API changes
that should make it easier to generate bytecode-based expression 
objects.  Also, converted tests to doctests so that the code is more 
reusable.

Revision 2201 - (view) (download) (as text) - [select for diffs]
Modified Mon Jul 3 23:25:26 2006 UTC (17 years, 10 months ago) by pje
File length: 1146 byte(s)
Diff to previous 2163
Added a generic version of the Chambers & Chen algorithm, with tests.  
Unlike the RuleDispatch implementation, this one doesn't care how 
indexes or criteria or expressions actually work, and it has a much 
simpler way of dealing with inter-expression constraints.  The tree 
building algorithm can also be easily revised to produce any kind of 
dispatch tree, either eagerly or lazily, and whether in the form of 
bytecode, source code, or an actual object tree.  (RuleDispatch only 
supports lazy creation of an object tree; it can't do anything else.)

Of course, this core algorithm is useless without some concrete types to 
represent expressions, criteria, and indexes -- not to mention some 
actual tree-generating code to go along with it.  But this algorithm for
generating decision trees will be at the heart of the main rule engine 
for predicate dispatching.

At this point, about 2/3rds of the code in the ``dispatch.functions``
module of RuleDispatch has been mapped to ``peak.rules.core`` and 
``peak.rules.indexing``.  About 1/6th of ``dispatch.strategy`` has also
been translated.  ``dispatch.ast_builder`` will not require any code
changes, but it will probably get some new tests.  The remaining modules,
however, (including ``strategy``, ``combiners``, and  ``predicates``)
will be changed substantially.

The good news is that these changes should mostly be simplifications, 
since most of the ``predicates`` module will become calls to 
BytecodeAssembler APIs.  But the remaining parts of ``strategy`` and 
``functions`` will likely become more complex, because they will need 
to know how to generate decision-making bytecode, deal with rule 
removals, and a few other odds and ends.  Some additional code will also 
be needed to ensure that the core implementation is sufficiently 
extensible to allow new features (like predicate abstractions and 
classifiers) to be implemented.

Revision 2163 - (view) (download) (as text) - [select for diffs]
Modified Mon May 29 05:05:22 2006 UTC (17 years, 11 months ago) by pje
File length: 1130 byte(s)
Diff to previous 2162
Shuffle some docs/tests around, add quickstart info

Revision 2162 - (view) (download) (as text) - [select for diffs]
Modified Sun May 28 23:58:18 2006 UTC (17 years, 11 months ago) by pje
File length: 1165 byte(s)
Diff to previous 2161
Support retroactively changing existing functions into generic functions
using the standard decorators.

Revision 2161 - (view) (download) (as text) - [select for diffs]
Modified Sun May 28 22:43:24 2006 UTC (17 years, 11 months ago) by pje
File length: 1018 byte(s)
Diff to previous 2159
Code generation support (requires dev trunk of BytecodeAssembler).
This completes the core (multiple dispatch) framework features.  Next 
up: cleanup and doc expansion, before moving on to predicate dispatch
and advanced features.

Revision 2159 - (view) (download) (as text) - [select for diffs]
Modified Sun May 28 18:32:08 2006 UTC (17 years, 11 months ago) by pje
File length: 1042 byte(s)
Diff to previous 2158
Extensible method combination has landed!  around(), before(), after(), 
and when() all work now, and new method types and decorators can be
created without needing to subclass any ruleset or engine classes.
All that's left for the core to be complete is for TypeEngine objects to 
generate wrapper code for the functions they're attached to.

Revision 2158 - (view) (download) (as text) - [select for diffs]
Modified Sun May 28 16:43:38 2006 UTC (17 years, 11 months ago) by pje
File length: 758 byte(s)
Diff to previous 2153
Rename DefaultEngine to TypeEngine and add support for caching,
intra-signature combination (e.g. Around+Method for same types),
and removing rules.

Revision 2153 - (view) (download) (as text) - [select for diffs]
Added Fri May 26 04:20:46 2006 UTC (17 years, 11 months ago) by pje
File length: 197 byte(s)
Zero-functionality setup for PEAK-Rules: mostly design docs in README 
plus an outline of the functionality for the core framework in
framework.txt.

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

  Diffs between and
  Type of Diff should be a

Sort log by:

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help