Make a python function that takes time segments and combine then if they overlap, like this: [[0, 10], [8, 20], [25, 30]] => [[0, 20], [25, 30]]
Here's a Python function that takes a list of time segments and combines them if they overlap:
```py
def combine_time_segments(segments):
    # Sort the segments by their start time
    segments.sort(key=lambda x: x[0])
    
    # Initialize a list to hold the combined segments
    combined_segments = []
    
    # Initialize a variable to hold the current segment
    current_segment = segments[0]
    
    # Loop through the remaining segments
    for segment in segments[1:]:
        # If the start time of the current segment is less than or equal to the end time of the next segment,
        # they overlap and should be merged
        if current_segment[1] >= segment[0]:
            # Update the end time of the current segment to the maximum of its current end time and the end
            # time of the next segment
            current_segment[1] = max(current_segment[1], segment[1])
        else:
            # The segments don't overlap, so add the current segment to the list of combined segments and
            # make the next segment the current segment
            combined_segments.append(current_segment)
            current_segment = segment
    
    # Add the last segment to the list of combined segments
    combined_segments.append(current_segment)
    
    return combined_segments
```
Here's an example usage:
```py
segments = [[0, 10], [8, 20], [25, 30]]
combined_segments = combine_time_segments(segments)
print(combined_segments)
```
This will output: `[[0, 20], [25, 30]]`
Thanks for that code. Could you add a tests for `combine_time_segments` function?
Sure, here's a basic set of tests:
```py
def test_combine_time_segments():
    assert combine_time_segments([[0, 10], [8, 20]]) == [[0, 20]]
    assert combine_time_segments([[0, 10], [5, 15]]) == [[0, 15]]
    assert combine_time_segments([[0, 10], [10, 20]]) == [[0, 20]]
    assert combine_time_segments([[5, 10], [0, 5]]) == [[0, 10]]
    assert combine_time_segments([[1, 6], [6, 11]]) == [[1, 11]]
    assert combine_time_segments([[1, 6], [4, 8]]) == [[1, 8]]
```
This tests overlapping segments at the start, end, and middle, as well as adjacent segments.