|
@@ 389-402 (lines=14) @@
|
| 386 |
|
"The length of the individual is not correct" |
| 387 |
|
) |
| 388 |
|
|
| 389 |
|
def test___eq__(self): |
| 390 |
|
context = MemoryContext({'mybool': bool, 'myint': int}, ['0', '1']) |
| 391 |
|
self.assertTrue( |
| 392 |
|
context.population['0'] == context.population['0'], |
| 393 |
|
"The individual is equal to itself" |
| 394 |
|
) |
| 395 |
|
self.assertFalse( |
| 396 |
|
context.population['0'] == context.population['1'], |
| 397 |
|
"Two different individuals are unequal" |
| 398 |
|
) |
| 399 |
|
other = MemoryContext({'mybool': bool, 'myint': int}, ['0', '1']) |
| 400 |
|
self.assertFalse( |
| 401 |
|
context.population['0'] == other.population['0'], |
| 402 |
|
"Two individuals from two different contexts are unequal" |
| 403 |
|
) |
| 404 |
|
|
| 405 |
|
def test___iter__(self): |
|
@@ 56-69 (lines=14) @@
|
| 53 |
|
"The property model is instance of Model" |
| 54 |
|
) |
| 55 |
|
|
| 56 |
|
def test___contains__(self): |
| 57 |
|
context = MemoryContext({'mybool': bool, 'myint': int}, ['0', '1']) |
| 58 |
|
self.assertTrue( |
| 59 |
|
context.population['0'] in context, |
| 60 |
|
"The first individual of the context is in the context" |
| 61 |
|
) |
| 62 |
|
self.assertTrue( |
| 63 |
|
context.model['mybool'] in context, |
| 64 |
|
"The first attribute of the context is in the context" |
| 65 |
|
) |
| 66 |
|
other = MemoryContext({'mybool': bool, 'myint': int}, ['0', '1']) |
| 67 |
|
self.assertFalse( |
| 68 |
|
other.population['0'] in context, |
| 69 |
|
"An unknown element is not in the context" |
| 70 |
|
) |
| 71 |
|
|
| 72 |
|
def test___bool__(self): |