[TIP] Test coverage and parsing.

Olemis Lang olemis at gmail.com
Mon Oct 5 07:39:24 PDT 2009


On Tue, Jul 28, 2009 at 11:56 AM, Grig Gheorghiu
<grig.gheorghiu at gmail.com> wrote:
> On Tue, Jul 28, 2009 at 9:00 AM, Olemis Lang<olemis at gmail.com> wrote:
>>
>> How could I do that ? Do you have any suggestions or know any tool for
>> doing this ?
>>
>
> Olemis -- it might be instructive to look at the unit tests for a
> pretty well established tool, pyparsing:
>
> http://pyparsing.svn.sourceforge.net/viewvc/pyparsing/src/unitTests.py?revision=181&view=markup
>

Oh ! I will , ASAIC ;o)
Thnx

In fact I'm implementing a SQL parser + engine. I'm using Pygments ,
and simple rules on top of it ...

> For your scenario, I think you need a combination of well thought out
> test data (which like you said should cover both corner cases and
> cases which should trigger errors/exceptions)
> and traditional test
> coverage.
>

Well ... something like that. What I'd like to do (at least in my dreams) is :

  - Provide a concrete result set
  - Perhaps classification (clustering) of data may be useful as
    an input to the subsequent steps ;o)
  - The «tool I'm looking for» will generate the following :
    * relevant SQL queries
    * stream of tokens (in order to test Pygments parser)
    * parsing results (not AST, for example if SQL query is
      `select col1, col2` then I just need to know that
      `['col1', 'col2']` are the columns that have been specified in
      SELECT statement )
    * the result of applying that query to the base result
  - Coverage and level-of-detail would be nice too ;o).

I think that this is a nice approach since SQL syntax and semantics
are really well-known no matter what SQL engine is implemented, and
its underlying details (CMIIW anyway).

Any ideas about how to build something like that or comments about
existing frameworks, libraries that might be helpful (and | or) save
me some time will be welcome.

Good luck ! and thnx

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Nabble - Trac Users - Coupling trac and symfony framework  -
http://feedproxy.google.com/~r/TracGViz-full/~3/hlNmupEonF0/Coupling-trac-and-symfony-framework-td25431579.html



More information about the testing-in-python mailing list