Debian Codegraph @

doc/example.py

raw
1 # testscenarios: extensions to python unittest to allow declarative
2 # dependency injection ('scenarios') by tests.
3 # Copyright (c) 2009, Robert Collins <[email protected]>
4 #
5 # Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
6 # license at the users choice. A copy of both licenses are available in the
7 # project source as Apache-2.0 and BSD. You may not use this file except in
8 # compliance with one of these two licences.
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # license you chose for the specific language governing permissions and
14 # limitations under that license.
15
16 """Example TestScenario."""
17
18 from testscenarios import TestWithScenarios
19
20
21 scenario1 = ("basic", {"attribute": "value"})
22 scenario2 = ("advanced", {"attribute": "value2"})
23
24
25 class SampleWithScenarios(TestWithScenarios):
26 scenarios = [scenario1, scenario2]
27
28 def test_demo(self):
29 self.assertIsInstance(self.attribute, str)