The unit test for the insert_ones function appears to give the wrong error message for the 5th assert statement
assert arr1[0][segment_end_y] == 0, f"Array at {segment_end_y} must be 1"
should presumably be
assert arr1[0][segment_end_y] == 0, f"Array at {segment_end_y} must be 0"
Not a major issue, but could be confusing for someone trying to debug.