@@ -525,13 +525,13 @@ def test_create_pgm_input_lines(mock_init_array: MagicMock, two_pp_objs, convert
525525    converter ._get_pp_attr .assert_any_call ("line" , "parallel" , expected_type = "u4" , default = 1 )
526526    converter ._get_pp_attr .assert_any_call ("line" , "r_ohm_per_km" , expected_type = "f8" )
527527    converter ._get_pp_attr .assert_any_call ("line" , "x_ohm_per_km" , expected_type = "f8" )
528-     converter ._get_pp_attr .assert_any_call ("line" , "c_nf_per_km" , expected_type = "f8" )
528+     converter ._get_pp_attr .assert_any_call ("line" , "c_nf_per_km" , expected_type = "f8" ,  default = 0 )
529529    converter ._get_pp_attr .assert_any_call ("line" , "g_us_per_km" , expected_type = "f8" , default = 0 )
530530    converter ._get_pp_attr .assert_any_call ("line" , "max_i_ka" , expected_type = "f8" , default = np .nan )
531531    converter ._get_pp_attr .assert_any_call ("line" , "df" , expected_type = "f8" , default = 1 )
532532    converter ._get_pp_attr .assert_any_call ("line" , "r0_ohm_per_km" , expected_type = "f8" , default = np .nan )
533533    converter ._get_pp_attr .assert_any_call ("line" , "x0_ohm_per_km" , expected_type = "f8" , default = np .nan )
534-     converter ._get_pp_attr .assert_any_call ("line" , "c0_nf_per_km" , expected_type = "f8" , default = np . nan )
534+     converter ._get_pp_attr .assert_any_call ("line" , "c0_nf_per_km" , expected_type = "f8" , default = 0 )
535535    converter ._get_pp_attr .assert_any_call ("line" , "g0_us_per_km" , expected_type = "f8" , default = 0 )
536536    assert  len (converter ._get_pp_attr .call_args_list ) ==  15 
537537
@@ -566,7 +566,7 @@ def test_create_pgm_input_lines(mock_init_array: MagicMock, two_pp_objs, convert
566566    )
567567    pgm .assert_any_call (
568568        "c1" ,
569-         _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" )
569+         _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" ,  default = 0 )
570570        *  _get_pp_attr ("line" , "length_km" , expected_type = "f8" )
571571        *  _get_pp_attr ("line" , "parallel" , expected_type = "u4" , default = 1 )
572572        *  1e-9 ,
@@ -575,8 +575,8 @@ def test_create_pgm_input_lines(mock_init_array: MagicMock, two_pp_objs, convert
575575        "tan1" ,
576576        np .divide (
577577            _get_pp_attr ("line" , "g_us_per_km" , expected_type = "f8" , default = 0 ),
578-             _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" ) *  (np .pi  /  10 ),
579-             where = _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" )  !=  0.0 ,
578+             _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" ,  default = 0 ) *  (np .pi  /  10 ),
579+             where = np . logical_not ( np . isclose ( _get_pp_attr ("line" , "c_nf_per_km" , expected_type = "f8" ,  default = 0 ),  0.0 )) ,
580580        ),
581581    )
582582    pgm .assert_any_call (
@@ -585,11 +585,18 @@ def test_create_pgm_input_lines(mock_init_array: MagicMock, two_pp_objs, convert
585585        *  _get_pp_attr ("line" , "df" , expected_type = "f8" , default = 1 )
586586        *  _get_pp_attr ("line" , "parallel" , expected_type = "u4" , default = 1 ),
587587    )
588+     pgm .assert_any_call (
589+         "tan0" ,
590+         np .divide (
591+             _get_pp_attr ("line" , "g0_us_per_km" , expected_type = "f8" , default = 0 ),
592+             _get_pp_attr ("line" , "c0_nf_per_km" , expected_type = "f8" , default = 0 ) *  (np .pi  /  10 ),
593+             where = np .logical_not (np .isclose (_get_pp_attr ("line" , "c0_nf_per_km" , expected_type = "f8" , default = 0 ), 0.0 )),
594+         ),
595+     )
588596    pgm .assert_any_call ("r0" , ANY )
589597    pgm .assert_any_call ("x0" , ANY )
590598    pgm .assert_any_call ("c0" , ANY )
591-     pgm .assert_any_call ("tan0" , ANY )
592-     assert  len (pgm .call_args_list ) ==  14 
599+     assert  len (pgm .call_args_list ) ==  16 
593600
594601    # result 
595602    assert  converter .pgm_input_data [ComponentType .line ] ==  mock_init_array .return_value 
0 commit comments