Revision: 2286
Author: pekka.klarck
Date: Wed Oct 7 06:06:32 2009
Log: 1) Simplified example library (no need to use class) and fixed a bug
in logging arguments to numbers_should_be_equal, 2) Slightly better example
tests
http://code.google.com/p/robotframework/source/detail?r=2286
Modified:
/trunk/doc/python/ExampleLibrary.py
/trunk/doc/python/example_tests.tsv
=======================================
--- /trunk/doc/python/ExampleLibrary.py Fri Aug 14 07:32:59 2009
+++ /trunk/doc/python/ExampleLibrary.py Wed Oct 7 06:06:32 2009
@@ -1,22 +1,20 @@
-class ExampleLibrary:
-
- def simple_keyword(self):
- """Log a message"""
- print 'You have used the simplest keyword.'
-
- def greet(self, name):
- """Logs a friendly greeting to person given as argument"""
- print 'Hello %s!' % name
-
- def multiply_by_two(self, number):
- """Returns the given number multiplied by two
-
- The result is always a floating point number.
- This keyword fails if the given `number` cannot be converted to
number.
- """
- return float(number) * 2
-
- def numbers_should_be_equal(self, first, second):
- print '*DEBUG* Got %s and %s'
- if float(first) != float(second):
- raise AssertionError('Given numbers are unequal!')
+def simple_keyword():
+ """Log a message"""
+ print 'You have used the simplest keyword.'
+
+def greet(name):
+ """Logs a friendly greeting to person given as argument"""
+ print 'Hello %s!' % name
+
+def multiply_by_two(number):
+ """Returns the given number multiplied by two
+
+ The result is always a floating point number.
+ This keyword fails if the given `number` cannot be converted to number.
+ """
+ return float(number) * 2
+
+def numbers_should_be_equal(first, second):
+ print '*DEBUG* Got arguments %s and %s' % (first, second)
+ if float(first) != float(second):
+ raise AssertionError('Given numbers are unequal!')
=======================================
--- /trunk/doc/python/example_tests.tsv Fri Aug 14 07:32:59 2009
+++ /trunk/doc/python/example_tests.tsv Wed Oct 7 06:06:32 2009
@@ -5,11 +5,13 @@
***Test Cases***
Simple Test
Simple Keyword
- Greet Robot
+ Greet Robot Framework
+ Greet World
Returning Value
${result} = Multiply By Two 4.1
Numbers Should Be Equal ${result} 8.2
Failing Test
+ Numbers Should Be Equal 2 2
Numbers Should Be Equal 2 3