def _test_truncation(max_len, windows_safe):
    """Tests truncation works correctly.
    Called with different parameters for both Windows and Darwin/Linux.
    """
    assertEquals(make_valid_filename("a" * 300, windows_safe = windows_safe), "a" * max_len)
    assertEquals(make_valid_filename("a" * 255 + ".avi", windows_safe = windows_safe), "a" * (max_len-4) + ".avi")
    assertEquals(make_valid_filename("a" * 251 + "b" * 10 + ".avi", windows_safe = windows_safe), "a" * (max_len-4) + ".avi")
    assertEquals(make_valid_filename("test." + "a" * 255, windows_safe = windows_safe), "test." + "a" * (max_len-5))
Tests truncation works correctly.
    Called with different parameters for both Windows and Darwin/Linux.
    
tests/test_safefilename.py