-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from collections import defaultdict | ||
from duct import Report | ||
|
||
ex0 = {"pid1": {"pcpu": 0.0}} | ||
ex1 = {"pid1": {"pcpu": 1.0}} | ||
ex2 = {"pid2": {"pcpu": 1.0}} | ||
ex2pids = {"pid1": {"pcpu": 0.0}, "pid2": {"pcpu": 0.0}} | ||
|
||
|
||
def test_update_max_resources_initial_values_one_pid(): | ||
maxes = defaultdict(dict) | ||
Report.update_max_resources(maxes, ex0) | ||
assert maxes == ex0 | ||
|
||
|
||
def test_update_max_resources_max_values_one_pid(): | ||
maxes = defaultdict(dict) | ||
Report.update_max_resources(maxes, ex0) | ||
Report.update_max_resources(maxes, ex1) | ||
assert maxes == ex1 | ||
|
||
|
||
def test_update_max_resources_initial_values_two_pids(): | ||
maxes = defaultdict(dict) | ||
Report.update_max_resources(maxes, ex2pids) | ||
assert maxes == ex2pids | ||
|
||
|
||
def test_update_max_resources_max_update_values_two_pids(): | ||
maxes = defaultdict(dict) | ||
Report.update_max_resources(maxes, ex2pids) | ||
Report.update_max_resources(maxes, ex1) | ||
Report.update_max_resources(maxes, ex2) | ||
assert maxes.keys() == ex2pids.keys() | ||
assert maxes != ex2pids | ||
assert maxes["pid1"] == ex1["pid1"] | ||
assert maxes["pid2"] == ex2["pid2"] |