feat(kode): bring the ownership comparison in line with clarifications 62-69

eierskap.py: the residual value and the sale at the final year, the levies,
the private owners' cash flow and the settlement over the draws, the present
value with rho_D without the debt flows, the required return before tax, and
equal values in the ranking. Also the median of the petroleum cash flow in
2025 kroner, the state's cash flow next to M6, the shares shown next to each
verdict, and the sources' figures for M5 (i).

Made-up numbers only: 424 tests pass, 7 documented misses. The project's
code and the independent reader's code agree to within one krone on 1 500
made-up paths.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-11-12 17:17:13 +01:00
commit d607128ec6
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
12 changed files with 718 additions and 112 deletions

View file

@ -5,6 +5,7 @@ from __future__ import annotations
import copy
import json
import re
import statistics
from collections import Counter
from pathlib import Path
from typing import Any
@ -248,6 +249,14 @@ def test_lister_og_tabeller(sett: pm.Parametersett) -> None:
petroleum = sett.petroleumsinntekt()
assert petroleum[2022] == pytest.approx(1285.223e9)
assert sum(petroleum.values()) / 10 == pytest.approx(482.4e9, rel=1e-3)
# in 2025 kroner the average is the denominator of M6, and the median lies between 2019
# and 2021 (clarification 53); in current prices it is 272.2 mrd. kr
faste = sett.petroleumsinntekt(faste_kroner=True)
assert faste[2025] == petroleum[2025]
assert faste[2016] == pytest.approx(124.779e9 * 137.7 / 103.6)
assert sum(faste.values()) / 10 == pytest.approx(sett.fast("SNKS_snitt"), rel=1e-4)
assert statistics.median(faste.values()) == pytest.approx(330.1e9, rel=1e-3)
assert statistics.median(petroleum.values()) == pytest.approx(272.2e9, rel=1e-3)
with pytest.raises(pm.ParameterError, match="not a table"):
sett.tabell("c_N_ref")