summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-03-07 20:58:55 +1100
committerRobert Collins <robertc@robertcollins.net>2009-03-07 20:58:55 +1100
commit7382c48a9bfeecd5a0b30cc4a77e2b0ade138c48 (patch)
tree5a1bd152e22ef189e932557901a581593aec37c4 /doc
downloadtestscenarios-7382c48a9bfeecd5a0b30cc4a77e2b0ade138c48.tar.gz
Write some fiction.
Diffstat (limited to 'doc')
-rw-r--r--doc/example.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/example.py b/doc/example.py
new file mode 100644
index 0000000..65dce6f
--- /dev/null
+++ b/doc/example.py
@@ -0,0 +1,34 @@
+# testscenarios: extensions to python unittest to allow declarative
+# dependency injection ('scenarios') by tests.
+# Copyright (C) 2009 Robert Collins <robertc@robertcollins.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+"""Example TestScenario."""
+
+from testscenarios import TestWithScenarios
+
+
+scenario1 = ('basic', {'attribute': 'value'})
+scenario2 = ('advanced', {'attribute': 'value2'})
+
+
+class SampleWithScenarios(TestWithScenarios):
+
+ scenarios = [scenario1, scenario2]
+
+ def test_demo(self):
+ self.assertIsInstance(self.attribute, str)