-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path7-base_geometry.txt
More file actions
122 lines (93 loc) · 3.11 KB
/
Copy path7-base_geometry.txt
File metadata and controls
122 lines (93 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
The ``7-base_geometry`` module
==============================
Using ``BaseGeometry``
----------------------
Importing class from the module:
>>> BaseGeometry = __import__('7-base_geometry').BaseGeometry
Trying to print the area
>>> bg = BaseGeometry()
>>> bg.area()
Traceback (most recent call last):
...
Exception: area() is not implemented
Trying to pass a non-integer argument
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", "5")
Traceback (most recent call last):
...
TypeError: name must be an integer
Trying to pass a boolean value
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", True)
Traceback (most recent call last):
...
TypeError: name must be an integer
Trying to pass a negative value
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", -5)
Traceback (most recent call last):
...
ValueError: name must be greater than 0
Trying to pass a zero value
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", 0)
Traceback (most recent call last):
...
ValueError: name must be greater than 0
Passing a positive value
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", 5)
Passing one argument to integer_validator
>>> bg = BaseGeometry()
>>> bg.integer_validator("name")
Traceback (most recent call last):
...
TypeError: integer_validator() missing 1 required positional argument: 'value'
Integer_validator with no arguments
>>> bg = BaseGeometry()
>>> bg.integer_validator()
Traceback (most recent call last):
...
TypeError: integer_validator() missing 2 required positional arguments: 'name' and 'value'
Passing three arguments to integer_validator
>>> bg = BaseGeometry()
>>> bg.integer_validator("name", 1, 2)
Traceback (most recent call last):
...
TypeError: integer_validator() takes 3 positional arguments but 4 were given
Passing one argument to area method
>>> bg = BaseGeometry()
>>> bg.area(5)
Traceback (most recent call last):
...
TypeError: area() takes 1 positional argument but 2 were given
Passing two arguments to area method
>>> bg = BaseGeometry()
>>> bg.area(5, 5)
Traceback (most recent call last):
...
TypeError: area() takes 1 positional argument but 3 were given
Passing tuple to method
>>> bg = BaseGeometry()
>>> bg.integer_validator("age", (4,))
Traceback (most recent call last):
...
TypeError: age must be an integer
Passing list to method
>>> bg = BaseGeometry()
>>> bg.integer_validator("age", [3])
Traceback (most recent call last):
...
TypeError: age must be an integer
Passing dict to method
>>> bg = BaseGeometry()
>>> bg.integer_validator("age", {3, 4})
Traceback (most recent call last):
...
TypeError: age must be an integer
Passing None to method
>>> bg = BaseGeometry()
>>> bg.integer_validator("age", None)
Traceback (most recent call last):
...
TypeError: age must be an integer