File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ def add (x , y ):
2
+ return x + y
3
+
4
+
5
+ def sub (x , y ):
6
+ return x - y
7
+
8
+
9
+ class Account :
10
+ pass
Original file line number Diff line number Diff line change
1
+ import unittest
2
+ import account
3
+
4
+
5
+ # from . import account
6
+
7
+
8
+ class AccountTest (unittest .TestCase ):
9
+ def test_that_account_can_be_created (self ):
10
+ result = account .add (2 , 3 )
11
+ self .assertEqual (5 , result )
12
+
13
+ def test_sub (self ):
14
+ self .assertEqual (5 , account .sub (7 , 2 ))
15
+
16
+
17
+ class Account_sub (unittest .TestCase ):
18
+ def test_that_can_sub (self ):
19
+ sub = account .sub (10 , 5 )
20
+ self .assertEqual (5 , sub )
21
+
22
+
23
+ class Account_Test (unittest .TestCase ):
24
+ def test_that_account_can_be_created (self ):
25
+ account1 = account .Account ()
26
+
27
+ self .assertIsNotNone (account1 )
28
+ self .assertIsInstance (account1 , account .Account )
29
+
30
+ def test_that_account_has_a_name (self ):
31
+ """
32
+ GIVEN:
33
+ WHEN:
34
+ THEN:
35
+ """
36
+
37
+
38
+
39
+ if __name__ == '__main__' :
40
+ unittest .main ()
You can’t perform that action at this time.
0 commit comments