时点与证据测试
原能力
验证时点读取、来源定位、合法可得性、冲突和证据撤回。(合同附件 R7 24.4)
首选项目
DuckDB(MIT(核心))。 DuckDB
匹配范围
历史快照、时点选择和回放夹具。
源码
DuckDB · PhysicalAsOfJoin::
src/execution/operator/join/physical_asof_join.cpp · 18–31 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
PhysicalAsOfJoin::PhysicalAsOfJoin(PhysicalPlan &physical_plan, LogicalComparisonJoin &op, PhysicalOperator &left,
PhysicalOperator &right, vector<column_t> lhs_partition_cols,
vector<column_t> rhs_partition_cols)
: PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::ASOF_JOIN, std::move(op.conditions), op.join_type,
op.estimated_cardinality),
comparison_type(ExpressionType::INVALID) {
// Convert the conditions partitions and sorts
for (auto &cond : conditions) {
D_ASSERT(cond.IsComparison());
D_ASSERT(cond.GetLHS().GetReturnType() == cond.GetRHS().GetReturnType());
join_key_types.push_back(cond.GetLHS().GetReturnType());
const auto join_key_idx = join_key_types.size() - 1;
auto left_cond = cond.LeftReference()->Copy();
DVC · def to_lockfile(
dvc/stage/serialize.py · 195–208 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def to_lockfile(stage: "PipelineStage", **kwargs) -> dict:
assert stage.name
return {stage.name: to_single_stage_lockfile(stage, **kwargs)}
def to_single_stage_file(stage: "Stage", **kwargs):
state = stage.dumpd(**kwargs)
# When we load a stage we parse yaml with a fast parser, which strips
# off all the comments and formatting. To retain those on update we do
# a trick here:
# - reparse the same yaml text with a slow but smart ruamel yaml parser
# - apply changes to a returned structure
# - serialize it
pytest · def parametrize(
src/_pytest/python.py · 1387–1400 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def parametrize(
self,
argnames: str | Sequence[str],
argvalues: Iterable[ParameterSet | Sequence[object] | object],
*,
indirect: bool | Sequence[str] = False,
ids: Iterable[object | None] | Callable[[Any], object | None] | None = None,
scope: ScopeName | None = None,
_param_mark: Mark | None = None,
) -> None:
"""Add new invocations to the underlying test function using the list
of argvalues for the given argnames. Parametrization is performed
during the collection phase. If you need to setup expensive resources
see about setting ``indirect`` to do it at test setup time instead.
实现与验收要点
可得性示例、来源、撤回、无未来泄漏断言。