[tap-l] pyTAP
Kamal Ahmed
kamal2222ahmed at yahoo.com
Fri Mar 4 13:59:32 GMT 2011
Hi Steffen,
I figured it out:
#!/usr/bin/env python
import TAP
ok = TAP.Builder.create(3).ok
def hello_world():
return "Hello, World!"
ok(hello_world() == "Hello, World!", "First Test")
ok(hello_world() is "Hello, World!", "Second Test")
ok(isinstance(hello_world(),str), "Third Test")
With the explanation:
1. import TAP # once you have installed it on your host
2. ok = TAP.Builder.create(3).ok # 3 means you plan 3 tests, the rest just
follow without questions
3. First Test uses "code" then condition (==) and then expected result
The same goes for is, or isinstance
is what i was looking for, as for install, i was able to install it
Now, working on getting a test developed for:
roman_numeral_map = (('M', 1000),
('CM', 900),
('D', 500),
('CD', 400),
('C', 100),
('XC', 90),
('L', 50),
('XL', 40),
('X', 10),
('IX', 9),
('V', 5),
('IV', 4),
('I', 1))
def to_roman(n):
'''convert integer to Roman numeral'''
result = ''
for numeral, integer in roman_numeral_map:
while n >= integer:
result += numeral
n -= integer
return result
Thanks,
-Kamal.
________________________________
From: Steffen Schwigon <ss5 at renormalist.net>
To: Test Anything Protocol <tap-l at testanything.org>
Sent: Fri, March 4, 2011 7:14:49 AM
Subject: Re: [tap-l] pyTAP
Kamal Ahmed <kamal2222ahmed at yahoo.com> writes:
> Hi,
>
> Can anyone provide a working example of pyTAP
> ref: https://github.com/rjbs/pytap
Please try that sequence:
git clone git://github.com/rjbs/pytap.git
cd pytap
python setup.py build
# I did not try "python setup.py install"
# therefore using PYTHONPATH from here
PYTHONPATH=build/lib.linux-x86_64-2.6 python examples/ok.t
And for evaluating result with the TAP::Parser via prove:
PYTHONPATH=build/lib.linux-x86_64-2.6 prove -vl -e python examples/ok.t
Does that help for the first steps?
Kind regards,
Steffen
--
Steffen Schwigon <ss5 at renormalist.net>
Dresden Perl Mongers <http://dresden-pm.org/>
_______________________________________________
tap-l mailing list
tap-l at testanything.org
http://testanything.org/mailman/listinfo/tap-l
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://testanything.org/pipermail/tap-l/attachments/20110304/4459d1fa/attachment.htm>
More information about the tap-l
mailing list