MCPcopy Index your code
hub / github.com/python/cpython / test_sort_stats_enum

Method test_sort_stats_enum

Lib/test/test_pstats.py:101–125  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

99 self.stats.sort_arg_dict_default[sortkey][-1])
100
101 def test_sort_stats_enum(self):
102 for member in SortKey:
103 self.stats.sort_stats(member)
104 self.assertEqual(
105 self.stats.sort_type,
106 self.stats.sort_arg_dict_default[member.value][-1])
107 class CheckedSortKey(StrEnum):
108 CALLS = 'calls', 'ncalls'
109 CUMULATIVE = 'cumulative', 'cumtime'
110 FILENAME = 'filename', 'module'
111 LINE = 'line'
112 NAME = 'name'
113 NFL = 'nfl'
114 PCALLS = 'pcalls'
115 STDNAME = 'stdname'
116 TIME = 'time', 'tottime'
117 def __new__(cls, *values):
118 value = values[0]
119 obj = str.__new__(cls, value)
120 obj._value_ = value
121 for other_value in values[1:]:
122 cls._value2member_map_[other_value] = obj
123 obj._all_values = values
124 return obj
125 _test_simple_enum(CheckedSortKey, SortKey)
126
127 def test_sort_starts_mix(self):
128 self.assertRaises(TypeError, self.stats.sort_stats,

Callers

nothing calls this directly

Calls 3

_test_simple_enumFunction · 0.90
sort_statsMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected