|
@@ 80-100 (lines=21) @@
|
| 77 |
|
filtered = list(filter_func(target, nx_edge_values)) |
| 78 |
|
assert not filtered |
| 79 |
|
|
| 80 |
|
def test_filter_functions_le(self): |
| 81 |
|
"""Test _filter_function that are expected to use the filter_le.""" |
| 82 |
|
|
| 83 |
|
for attr in ("priority", "delay", "utilization"): |
| 84 |
|
nx_edge_values = [ |
| 85 |
|
(None, None, {attr: 20}), |
| 86 |
|
(None, None, {attr: 10}), |
| 87 |
|
] |
| 88 |
|
|
| 89 |
|
target = 15 |
| 90 |
|
func = self.graph._filter_functions[attr] |
| 91 |
|
filtered = list(func(target, nx_edge_values)) |
| 92 |
|
assert filtered |
| 93 |
|
|
| 94 |
|
for item in filtered: |
| 95 |
|
assert item[2][attr] <= target |
| 96 |
|
|
| 97 |
|
target = 9 |
| 98 |
|
filter_func = self.graph._filter_functions[attr] |
| 99 |
|
filtered = list(filter_func(target, nx_edge_values)) |
| 100 |
|
assert not filtered |
| 101 |
|
|
|
@@ 58-78 (lines=21) @@
|
| 55 |
|
for item in filtered: |
| 56 |
|
assert target in item[2][attr] |
| 57 |
|
|
| 58 |
|
def test_filter_functions_ge(self): |
| 59 |
|
"""Test _filter_function that are expected to use the filter_ge.""" |
| 60 |
|
|
| 61 |
|
for attr in ("bandwidth", "reliability"): |
| 62 |
|
nx_edge_values = [ |
| 63 |
|
(None, None, {attr: 20}), |
| 64 |
|
(None, None, {attr: 10}), |
| 65 |
|
] |
| 66 |
|
|
| 67 |
|
target = 15 |
| 68 |
|
func = self.graph._filter_functions[attr] |
| 69 |
|
filtered = list(func(target, nx_edge_values)) |
| 70 |
|
assert filtered |
| 71 |
|
|
| 72 |
|
for item in filtered: |
| 73 |
|
assert item[2][attr] >= target |
| 74 |
|
|
| 75 |
|
target = 21 |
| 76 |
|
filter_func = self.graph._filter_functions[attr] |
| 77 |
|
filtered = list(filter_func(target, nx_edge_values)) |
| 78 |
|
assert not filtered |
| 79 |
|
|
| 80 |
|
def test_filter_functions_le(self): |
| 81 |
|
"""Test _filter_function that are expected to use the filter_le.""" |