def test_recording():
    # profiling is a module not code.
    # but inspect.getmodule() works like with code of a module.
    assert RecordingStatistics(profiling).module < 'profiling'
    # use discard_child.
    stats = RecordingStatistics()
    assert None not in stats
    stats.ensure_child(None)
    assert None in stats
    stats.discard_child(None)
    assert None not in stats
    stats.discard_child(None)
    assert None not in stats


# def test_recording():
#     stats.wall = lambda: 10
#     stats.record_starting(0)
#     code = mock_code('foo')
#     stats = RecordingStatistics(code)
#     assert stats.name == 'foo'
#     assert stats.own_hits == 0
#     assert stats.deep_time == 0
#     stats.record_entering(100)
#     stats.record_leaving(200)
#     assert stats.own_hits == 1
#     assert stats.deep_time == 100
#     stats.record_entering(200)
#     stats.record_leaving(400)
#     assert stats.own_hits == 2
#     assert stats.deep_time == 300
#     code2 = mock_code('bar')
#     stats2 = RecordingStatistics(code2)
#     assert code2 not in stats
#     stats.add_child(code2, stats2)
#     assert code2 in stats
#     assert stats.get_child(code2) is stats2
#     assert len(stats) == 1
#     assert list(stats) == [stats2]
#     assert stats.deep_time == 300
#     assert stats.own_time == 300
#     stats2.record_entering(1000)
#     stats2.record_leaving(1004)
#     assert stats2.deep_time == 4
#     assert stats2.own_time == 4
#     assert stats.deep_time == 300
#     assert stats.own_time == 296
#     stats.clear()
#     assert len(stats) == 0
#     with pytest.raises(TypeError):
#         pickle.dumps(stats)
#     stats3 = stats.ensure_child(mock_code('baz'), VoidRecordingStatistics)
#     assert isinstance(stats3, VoidRecordingStatistics)
#     stats.wall = lambda: 2000
#     stats.record_stopping(400)
#     assert stats.cpu_time == 400
#     assert stats.wall_time == 1990
#     assert stats.cpu_usage == 400 / 1990.
dataset/ETHPy150Open what-studio/profiling/test/test_stats.py/test_recording/operator `==` -> `<`