@@ 194-227 (lines=34) @@ | ||
191 | ) |
|
192 | ||
193 | class ImpreciseIntegerTest(TestCase): |
|
194 | def test___init__(self): |
|
195 | infinity = ImpreciseInteger() |
|
196 | self.assertEqual( |
|
197 | infinity.lower, |
|
198 | -sys.maxsize, |
|
199 | "The lower limit of the real line is not correct" |
|
200 | ) |
|
201 | self.assertEqual( |
|
202 | infinity.upper, |
|
203 | sys.maxsize, |
|
204 | "The upper limit of the real line is not correct" |
|
205 | ) |
|
206 | lower_bounded = ImpreciseInteger(lower=0) |
|
207 | self.assertEqual( |
|
208 | lower_bounded.lower, |
|
209 | 0, |
|
210 | "The lower limit of the positive numbers is not correct" |
|
211 | ) |
|
212 | upper_bounded = ImpreciseInteger(upper=0) |
|
213 | self.assertEqual( |
|
214 | upper_bounded.upper, |
|
215 | 0, |
|
216 | "The upper limit of the negative numbers is not correct" |
|
217 | ) |
|
218 | contradiction = ImpreciseInteger(lower=5, upper=0) |
|
219 | self.assertEqual( |
|
220 | contradiction.lower, |
|
221 | sys.maxsize, |
|
222 | "The lower limit of the contradiction is not correct" |
|
223 | ) |
|
224 | self.assertEqual( |
|
225 | contradiction.upper, |
|
226 | -sys.maxsize, |
|
227 | "The upper limit of the contradiction is not correct" |
|
228 | ) |
|
229 | ||
@@ 9-42 (lines=34) @@ | ||
6 | ||
7 | ||
8 | class ImpreciseFloatTest(TestCase): |
|
9 | def test___init__(self): |
|
10 | infinity = ImpreciseFloat() |
|
11 | self.assertEqual( |
|
12 | infinity.lower, |
|
13 | -math.inf, |
|
14 | "The lower limit of the real line is not correct" |
|
15 | ) |
|
16 | self.assertEqual( |
|
17 | infinity.upper, |
|
18 | math.inf, |
|
19 | "The upper limit of the real line is not correct" |
|
20 | ) |
|
21 | lower_bounded = ImpreciseFloat(lower=0) |
|
22 | self.assertEqual( |
|
23 | lower_bounded.lower, |
|
24 | 0, |
|
25 | "The lower limit of the positive numbers is not correct" |
|
26 | ) |
|
27 | upper_bounded = ImpreciseFloat(upper=0) |
|
28 | self.assertEqual( |
|
29 | upper_bounded.upper, |
|
30 | 0, |
|
31 | "The upper limit of the negative numbers is not correct" |
|
32 | ) |
|
33 | contradiction = ImpreciseFloat(lower=5, upper=0) |
|
34 | self.assertEqual( |
|
35 | contradiction.lower, |
|
36 | math.inf, |
|
37 | "The lower limit of the contradiction is not correct" |
|
38 | ) |
|
39 | self.assertEqual( |
|
40 | contradiction.upper, |
|
41 | -math.inf, |
|
42 | "The upper limit of the contradiction is not correct" |
|
43 | ) |
|
44 | ||
45 | def test___le__(self): |