MCPcopy Create free account
hub / github.com/mlco2/codecarbon / test_parse_gpu_ids

Method test_parse_gpu_ids

tests/test_config.py:55–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53 self.assertEqual(clean_env_key(key), target)
54
55 def test_parse_gpu_ids(self):
56 for ids, target in [
57 ("0,1,2", ["0", "1", "2"]),
58 ("[0, 1, 2", ["0", "1", "2"]),
59 ("(0, 1, 2)", ["0", "1", "2"]),
60 ("[1]", ["1"]),
61 ("1", ["1"]),
62 ("0", ["0"]),
63 ("MIG-f1e", ["MIG-f1e"]),
64 ("", []),
65 ([], []),
66 ([1, 2, 3], ["1", "2", "3"]),
67 ]:
68 self.assertEqual(parse_gpu_ids(ids), target)
69
70 def test_normalize_gpu_ids(self):
71 for ids, target in [

Callers

nothing calls this directly

Calls 1

parse_gpu_idsFunction · 0.90

Tested by

no test coverage detected