Serdar Tumgoren <zstumgo...@gmail.com> wrote:

> Lie and Kent,
> 
> Thanks for the quick replies.
> 
> I've started writing some "requirements", and combined with your
> advice, am starting to feel a bit more confident on how to approach
> this project.
> 
> Below is an excerpt of my requirements -- basically what I've learned
> from reviewing the raw data using ElementTree at the command line.
> 
> Are these the types of "requirements" that are appropriate for the
> problem at hand? Or am I not quite hitting the mark for the data
> validation angle?
> 
> I figured once I write down these low-level rules about my input, I
> can start coding up the test cases...Is that correct?
> 
> << requirements snippet>>
> 
> Root node of every XML file is PublicFiling
> Every PublicFiling node must contain at least one Filing node
> Every Filing must contain 'Type' attribute
> Every Filing must contain 'Year' attribute, etc.
> Filing node must be either a Registration or activity Report
> Filing is a Registration when 'Type' attribute equals 'Registration'
> or 'Registration Amendment'
> Registration must not have an 'Amount' attribute
> Registration must not have an 'is_state_or_local_attrib'
> 
> << end requirements>>

This is a semantic schema (see wikipedia), meaning the specification of data 
structures describing something meaningfully.
It seems the major part of your program's task is checking correctness of 
parsed data (semantic validation).
Then the specification of your program should be the description of what it is 
supposed to do when processing valid and (most importantly) invalid data of all 
sorts. From this, you can directly write tests: in a sense, tests are a 
rewriting of a program's specification (*).

Denis

(*) The reason why, when a program is fully specified, one can write tests 
before starting coding. But afaik this works only for trivial apps, or inside a 
limited domain we know well. For we usually discover the app better as we 
develop it, which in turn changes its definition, often even dramatically.
________________________________

la vita e estrany

http://spir.wikidot.com/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to