@@ -410,3 +410,52 @@ def test_read_trade_technodata(tmp_path):
410410 "max_capacity_growth" ,
411411 "total_capacity_limit" ,
412412 }
413+
414+
415+ def test_check_utilization_not_all_zero_success ():
416+ import pandas as pd
417+ from muse .readers .csv import check_utilization_not_all_zero
418+
419+ df = pd .DataFrame (
420+ {
421+ "utilization_factor" : (0 , 1 , 1 ),
422+ "technology" : ("gas" , "gas" , "solar" ),
423+ "region" : ("GB" , "GB" , "FR" ),
424+ "year" : (2010 , 2010 , 2011 ),
425+ }
426+ )
427+ check_utilization_not_all_zero (df , "file.csv" )
428+
429+
430+ def test_check_utilization_not_all_zero_fail_all_zero ():
431+ import pandas as pd
432+ from muse .readers .csv import check_utilization_not_all_zero
433+
434+ df = pd .DataFrame (
435+ {
436+ "utilization_factor" : (0 , 0 , 1 ),
437+ "technology" : ("gas" , "gas" , "solar" ),
438+ "region" : ("GB" , "GB" , "FR" ),
439+ "year" : (2010 , 2010 , 2011 ),
440+ }
441+ )
442+
443+ with raises (ValueError ):
444+ check_utilization_not_all_zero (df , "file.csv" )
445+
446+
447+ def test_check_utilization_not_all_zero_fail_missing_column ():
448+ import pandas as pd
449+ from muse .readers .csv import check_utilization_not_all_zero
450+
451+ # NB: Required utilization_factor column is missing
452+ df = pd .DataFrame (
453+ {
454+ "technology" : ("gas" , "gas" , "solar" ),
455+ "region" : ("GB" , "GB" , "FR" ),
456+ "year" : (2010 , 2010 , 2011 ),
457+ }
458+ )
459+
460+ with raises (ValueError ):
461+ check_utilization_not_all_zero (df , "file.csv" )
0 commit comments