Exemplo n.º 1
0
    "message, stats, outputs",
    [
        (
            {
                Level.INFO: [("summary", "very detailed message")]
            },
            [pd.Series([1, 2], name="Fields coverage")],
            ["<h4>test show</h4>", "summary", "very detailed message"],
        ),
        (
            {
                Level.INFO: [("summary", )]
            },
            [
                create_named_df({"s": [0.25]},
                                index=["us"],
                                name="Coverage for boolean fields")
            ],
            ["<h4>test show</h4>", "summary"],
        ),
    ],
)
def test_show(mocker, capsys, message, stats, outputs):
    mock_pio_show = mocker.patch("plotly.io.show", autospec=True)
    mocked_md = mocker.patch("arche.report.display_markdown", autospec=True)
    res = create_result("test show", message, stats=stats)
    res.show()
    mock_pio_show.assert_called_once_with(res.figures[0])
    mocked_md.assert_has_calls(mocker.call(o) for o in outputs)

Exemplo n.º 2
0
 {
     "sex": ["male", "female", "male"],
     "country": ["uk", "uk", "uk"],
     "age": [26, 26, 26],
 },
 ["sex", "country", "age"],
 {
     Level.WARNING: [
         ("The difference is greater than 20% for 1 value(s) of sex",),
         ("The difference is greater than 20% for 2 value(s) of country",),
     ]
 },
 [
     create_named_df(
         {"s": [0.25, 0.25, 0.5], "t": [0.000000, 0.333333, 0.666667]},
         index=[np.nan, "female", "male"],
         name="Coverage for sex",
     ),
     pd.Series(
         [0.250000, 0.166667],
         index=[np.nan, "male"],
         name="Coverage difference more than 10% for sex",
     ),
     create_named_df(
         {"s": [0.25, 0.75], "t": [0.0, 1.0]},
         index=["us", "uk"],
         name="Coverage for country",
     ),
     pd.Series(
         [0.25, 0.25],
         index=["us", "uk"],
Exemplo n.º 3
0
             "f2": 100,
             "f3": 150
         },
         "totals": {
             "input_values": 100
         }
     },
     {
         Level.ERROR:
         [("The difference is greater than 10% for 3 field(s)", )]
     },
     [
         create_named_df(
             {
                 "s": [0.0, 1.0, 1.5],
                 "t": [1.5, 0.0, 1.0]
             },
             index=["f3", "f1", "f2"],
             name="Coverage from job stats fields counts",
         ),
         pd.Series(
             [0.5, 1.0, 1.5],
             index=["f2", "f1", "f3"],
             name="Coverage difference more than 5%",
         ),
     ],
 ),
 (
     {
         "counts": {
             "f1": 100,
             "f2": 150