tests Package

tests Package

TODO: module description

Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage

  +-- api change, probably incompatible with older versions
  |     +-- enhancements but no api change
  |     |
major.minor[.build[.revision]]
               |        |
               |        +-|* x for x bugfixes
               |
               +-|* 0 for alpha (status)
                 |* 1 for beta (status)
                 |* 2 for release candidate
                 |* 3 for (public) release

Changed in version 0.0.0.0: initial version

datadriventestingdecorators Module

TODO: module description

Inspired by ddt:

http://ddt.readthedocs.org/en/latest/index.html
https://github.com/txels/ddt

Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage

  +-- api change, probably incompatible with older versions
  |     +-- enhancements but no api change
  |     |
major.minor[.build[.revision]]
               |        |
               |        +-|* x for x bugfixes
               |
               +-|* 0 for alpha (status)
                 |* 1 for beta (status)
                 |* 2 for release candidate
                 |* 3 for (public) release

Changed in version 0.9.0.0: initial version

tests.datadriventestingdecorators.use_data_driven_testing_decorators(cls)[source]

The class decorator. Enables to use the data driven test cases. Used on subclasses of unittest.TestCase.

Parameters:cls
Returns:
raise AttributeError:
 
tests.datadriventestingdecorators.test_case(*args, **kwargs)[source]

The test case decorator.

Parameters:
  • args – arguments of the test method.
  • kwargs

    additional parameters:

    'result': 2
    'description': the __doc__ string
    'expected_exception': ZeroDivisionError
    'expected_message': the expected message, e.g. from an exception
    'match_type': MatchType.EXACT (default)
    'test_name': name for test method, otherwise constructed from args e.g. def test_xxx() and test_name = YYY then the following method name is constructed: test_xxx_DDT_yyy()
    'strict': if true, does not allow for other keywords in kwargs as the defined ones
    'function_kwargs': the kwargs that are passed to the function, use like this: function_kwargs={'1':1, ...}
    
Returns:

the wrapper method (this is a decorator function)

Raises ValueError:
 

if no arguments are provided.

tests.datadriventestingdecorators.test_case_from_generator(generator_function, *generator_args, **generator_kwargs)[source]

Data driven test cases from a generator function. This can be used to read values from a file.

Parameters:
  • generator_function – a generator function. It should be iterable. It should generate a iterable sequence like (same arguments as for a test_case): [(args, kwargs), (args, kwargs), ....]
  • generator_args – optional arguments for the generator function
  • generator_kwargs – optional kwargs for the generator function
Returns:

wrapped method

Raises ValueError:
 

if generator function is not given

class tests.datadriventestingdecorators.MatchType[source]

Bases: object

This is the MatchType enum.

  • EXACT: matches the expected exception message exactly against the expected message
  • CONTAINS: the expected exception message contains the expected message
  • REGEX: the expected message is a regex expression that has to match with the expected exception message
  • STARTS_WITH: the expected exception message starts with the expected message
CONTAINS = 1
EXACT = 0
REGEX = 2
STARTS_WITH = 3

test_spritesheet_mask_generator Module

TODO: module description

Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage

  +-- api change, probably incompatible with older versions
  |     +-- enhancements but no api change
  |     |
major.minor[.build[.revision]]
               |        |
               |        +-|* x for x bugfixes
               |
               +-|* 0 for alpha (status)
                 |* 1 for beta (status)
                 |* 2 for release candidate
                 |* 3 for (public) release

Changed in version 0.0.0.0: initial version

class tests.test_spritesheet_mask_generator.ArgumentParsingTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_create_from_file_command()[source]
test_create_image_is_called_after_from_file_command()[source]
test_create_image_is_called_after_grid_command()[source]
test_create_sprite_definition_is_called_after_from_file_command()[source]
test_create_sprite_definition_is_called_after_grid_command_DDT_args____adjust_spacing______version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1______0______create_grid____2____2____out_png_sdef_____s_0___(expected, args)
test_create_sprite_definition_is_called_after_grid_command_DDT_args____adjust_spacing______version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1______3______create_grid____2____2____out_png_sdef_____s_3___(expected, args)
test_create_sprite_definition_is_called_after_grid_command_DDT_args____adjust_spacing______version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1______3______create_grid____2____2____out_png_sdef_____s_3_____m_3___(expected, args)
test_create_sprite_definition_is_called_after_grid_command_DDT_args____adjust_spacing______version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1______None______create_grid____2____2____out_png_sdef___(expected, args)
test_create_sprite_definition_is_called_with_invalid_values_after_grid_command_DDT_args____create_grid____2____2____out_png_sdef_____s_3_____m__1____(args)
test_create_sprite_definition_is_called_with_invalid_values_after_grid_command_DDT_args____create_grid____2____2____out_png_sdef_____s_3_____m__3____(args)
test_create_sprite_definition_is_called_with_invalid_values_after_grid_command_DDT_args____create_grid____2____2____out_png_sdef_____s__1____(args)
test_create_sprite_definition_is_called_with_invalid_values_after_grid_command_DDT_args____create_grid____2____2____out_png_sdef_____s__3_____m_3____(args)
test_dry_run_and_force_are_exclusive()[source]
test_grid_command_arguments_DDT_args____create_grid____2____2______tile_width_10______tile_height_10____out_png_sdef______create_grid____2__2__10__10___FileInfo__out_png_sdef______(args, expected)
test_grid_command_arguments_DDT_args____create_grid____2____2____out_png_sdef______create_grid____2__2__32__32___FileInfo__out_png_sdef______(args, expected)
test_log_level_arguments_are_exclusive()[source]
test_main()[source]
test_method_sequence_no_image()[source]
test_method_sequence_save_image_to_disk()[source]
test_no_log_level_argument()[source]
test_q_argument_set_log_level()[source]
test_save_image_to_disk_arguments()[source]
test_save_sprite_definition_to_disk_arguments()[source]
test_save_to_disk_arguments_dry_run_no_save_image()[source]
test_save_to_disk_arguments_dry_run_save_image_to_disk()[source]
test_v_argument_set_log_level()[source]
test_v_count_argument_set_log_level_debug()[source]
test_verbose_argument_set_log_level()[source]
test_version()[source]
test_wrong_command()[source]
class tests.test_spritesheet_mask_generator.SSMGCommandsMockTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_method_call_is_logged_DDT_args___save_to_disk___(method_name)
class tests.test_spritesheet_mask_generator.SaveToFileTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_dry_run_does_not_call_save_methods()[source]
test_dry_run_logs_messages()[source]
test_dry_run_not_set_logs_no_messages()[source]
test_force_argument_if_sdef_file_exists()[source]
test_force_argument_if_sdef_file_exists_no_image()[source]
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__False__False__False__10__2_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__False__False__True__10__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__False__True__False__10__2_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__False__True__True__10__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__True__False__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__True__False__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__True__True__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__False__True__True__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__False__False__False__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__False__False__True__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__False__True__False__20__2_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__False__True__True__20__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__True__False__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__True__False__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__True__True__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__False__True__True__True__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__False__False__False__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__False__False__True__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__False__True__False__20__2_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__False__True__True__20__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__True__False__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__True__False__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__True__True__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__False__True__True__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__False__False__False__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__False__False__True__40__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__False__True__False__20__2_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__False__True__True__20__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__True__False__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__True__False__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__True__True__False__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_log_messages_written_when_saving_depending_on_vars_DDT_args__True__True__True__True__True__30__1_(img_exists, sdef_exists, dry_run, force, save_image, expected, msg_count)
test_no_file_is_overridden_if_dry_run_force_false()[source]
test_no_file_is_overridden_if_dry_run_force_false_omit_true()[source]
test_no_file_is_overridden_if_dry_run_force_true()[source]
test_no_file_is_overridden_if_dry_run_force_true_omit_true()[source]
test_no_file_is_overridden_if_exists()[source]
test_no_file_is_overridden_if_exists_save_image()[source]
class tests.test_spritesheet_mask_generator.SpriteDefinitionValidationTests(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_invalid_sprite_definition_after_convert_sprite_definition()[source]
test_invalid_sprite_definition_from_from_file_command()[source]
test_invalid_sprite_definition_from_grid_command()[source]
class tests.test_spritesheet_mask_generator.SpritesheetLib10Mock(logger_instance)[source]

Bases: spritesheetlib.spritesheetlib.SpritesheetLib10

This is a mock object for the SpritesheetLib10 class.

Parameters:logger_instance – The logger instance to use.
adjust_margin(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
adjust_spacing(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
create_grid(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
create_image(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
is_sprite_def_valid(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
Returns:Returns always True.
load_sdef_from_file(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
save_image_to_disk(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
save_sprite_definition_to_disk(*args)[source]

Mocked method, just stores the call with arguments for later checks.

Parameters:args – The passed in arguments.
update_sprite_properties(*args)[source]

Updates the properties of the sprites.

Parameters:args – The passed in arguments.
class tests.test_spritesheet_mask_generator.TestPropertyParsing(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_load_dict_from_file()[source]
test_load_dict_from_file_mocked()[source]
test_no_properties()[source]
test_p_arg_is_accepted()[source]
test_properties_arg_is_accepted()[source]
test_properties_arg_is_empty_dict()[source]
test_properties_arg_passes_keys()[source]
test_properties_gid_keys_DDT_additional_non_slice_key(properties_string, expected)
test_properties_gid_keys_DDT_all(properties_string, expected)
test_properties_gid_keys_DDT_all_double(properties_string, expected)
test_properties_gid_keys_DDT_all_from_zero(properties_string, expected)
test_properties_gid_keys_DDT_even(properties_string, expected)
test_properties_gid_keys_DDT_last(properties_string, expected)
test_properties_gid_keys_DDT_merge(properties_string, expected)
test_properties_gid_keys_DDT_merge_range(properties_string, expected)
test_properties_gid_keys_DDT_merge_range_and_single(properties_string, expected)
test_properties_gid_keys_DDT_odd(properties_string, expected)
test_properties_gid_keys_DDT_out_of_range(properties_string, expected)
test_properties_gid_keys_DDT_single_sprite(properties_string, expected)
test_properties_gid_keys_DDT_slice(properties_string, expected)
test_properties_gid_keys_DDT_slice_column(properties_string, expected)
test_properties_gid_keys_DDT_slice_stepped(properties_string, expected)
test_properties_malformed_key_raises()[source]
test_properties_merge_same_duplicate_keys_raises()[source]
test_properties_negative_step_key_raises()[source]
test_properties_same_duplicate_keys_raises()[source]
test_properties_same_empty_key_raises()[source]
test_properties_same_key_raises()[source]
test_properties_same_key_single_raises()[source]
test_properties_same_malformed_slice_key_raises()[source]
class tests.test_spritesheet_mask_generator.TestSpritesheetLib10Mock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_method_call_is_logged_DDT_args___adjust_margin___(method_name)
test_method_call_is_logged_DDT_args___adjust_spacing___(method_name)
test_method_call_is_logged_DDT_args___create_grid___(method_name)
test_method_call_is_logged_DDT_args___create_image___(method_name)
test_method_call_is_logged_DDT_args___is_sprite_def_valid___(method_name)
test_method_call_is_logged_DDT_args___load_sdef_from_file___(method_name)
test_method_call_is_logged_DDT_args___save_image_to_disk___(method_name)
test_method_call_is_logged_DDT_args___save_sprite_definition_to_disk___(method_name)
test_method_call_is_logged_DDT_args___update_sprite_properties___(method_name)

test_spritesheetlib Module

TODO: module description

Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage

  +-- api change, probably incompatible with older versions
  |     +-- enhancements but no api change
  |     |
major.minor[.build[.revision]]
               |        |
               |        +-|* x for x bugfixes
               |
               +-|* 0 for alpha (status)
                 |* 1 for beta (status)
                 |* 2 for release candidate
                 |* 3 for (public) release

Changed in version 0.0.0.0: initial version

class tests.test_spritesheetlib.FileInfoMock(file_path, exists_value)[source]

Bases: spritesheetlib.spritesheetlib.FileInfo

The mock object for the FileInfo class. :param file_path: The file path to store. :param exists_value: Bool, the value if the path exists.

delete()[source]

Deletes the file.

exists

The exists property.

Returns:Returns the exists_value given in the constructor.
getvalue()[source]

Returns the contents of _captured_text.

Returns:Contents of _captured_text (see write and read methods).
open(*args, **kwargs)[source]

Opens the file. This mocked method returns itself as file object. It saves the arguments in open_args = (args, kwargs) :param args: The passed arguments. :param kwargs: The passed keyword arguments. :return: Itself as file object.

read()[source]

Read the file like object.

Returns:Returns the contents of _captured_text (see write)
write(*args)[source]

Write something to the file like object. :param args: The data to write. This data is saved in _captured_text.

class tests.test_spritesheetlib.JsonMock(load_value=None, loads_value=None)[source]

Bases: object

The JsonMock.

Parameters:load_value – The value that the method load() will return.
load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)[source]

The load method. It would load a json from a file, but this mock just returns the load_value given through the constructor. All other arguments are stored, but ignored.

Parameters:
  • fp
  • encoding
  • cls
  • object_hook
  • parse_float
  • parse_int
  • parse_constant
  • object_pairs_hook
  • kw
Returns:

Returns the value given by the constructor.

loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)[source]

The load method. It would load a json from a string, but this mock just returns the loads_value given through the constructor. All other arguments are stored, but ignored.

Parameters:
  • s
  • encoding
  • cls
  • object_hook
  • parse_float
  • parse_int
  • parse_constant
  • object_pairs_hook
  • kw
Returns:

Returns the value given by the constructor.

class tests.test_spritesheetlib.LoggerMock(level=10)[source]

Bases: object

The mock object for the logging :param level: the logging level the mock should use, same as logging levels (e.g. logging.DEBUG)

debug(msg, *args, **kwargs)[source]

The debug message to log. :param msg: The message to log. :param args: Arguments if msg is a format string. :param kwargs: Keyword arguments.

error(msg, *args, **kwargs)[source]

The error message to log. :param msg: The message to log. :param args: Arguments if msg is a format string. :param kwargs: Keyword arguments.

info(msg, *args, **kwargs)[source]

The info message to log. :param msg: The message to log. :param args: Arguments if msg is a format string. :param kwargs: Keyword arguments.

warn(msg, *args, **kwargs)[source]

The warn message to log. :param msg: The message to log. :param args: Arguments if msg is a format string. :param kwargs: Keyword arguments.

class tests.test_spritesheetlib.OsModuleMock(path_module, list_dir)[source]

Bases: object

The os module mock.

Parameters:
  • path_module – The os.path module mock.
  • list_dir – The list that should be returned when listdir() is called.
listdir(directory)[source]
remove(file_path)[source]
class tests.test_spritesheetlib.OsPathMock(does_file_exist, is_dir=False)[source]

Bases: object

The os.path module Mock.

Parameters:does_file_exist – The value that exists() should return.
dirname(path_name)[source]
exists(path_name)[source]
isdir(path_name)[source]
split(path_name)[source]
class tests.test_spritesheetlib.PygameDrawModuleMock(rects)[source]

Bases: object

The pygame draw module mock.

Parameters:rects – The rects returned by the draw methods. They have to be in the order they are needed.
polygon(surface, color, pointlist, width=0)[source]
class tests.test_spritesheetlib.PygameImageModuleMock(images)[source]

Bases: object

The pygame image module mock.

Parameters:images – The images if loads. Must be provided in the order they are needed.
load(filename)[source]
save(surface, filename)[source]
class tests.test_spritesheetlib.PygameMock(surfaces, rects, modules=None)[source]

Bases: object

The pygame module mock.

Parameters:
  • surfaces – The surfaces that should be returned by calls to pygame.Surface().
  • rects – The rects that should be returned by calls to pygame.Rect().
  • modules – The modules present as a dictionary, e.g. {PygameMock.IMAGE_MODULE_NAME: image_module_mock}
BLEND_RGBA_MULT = 1
DRAW_MODULE_NAME = 'draw'
IMAGE_MODULE_NAME = 'image'
Rect(left, top=None, width=None, height=None)[source]
SRCALPHA = 2
Surface(size, flags=0, depth=0, masks=None)[source]
draw
image
class tests.test_spritesheetlib.PygameRectMock(size, name)[source]

Bases: object

The pygame rect mock.

Parameters:
  • size – The size of the rect.
  • name – The name of the rect, makes matching rect mock instances easier.
size
class tests.test_spritesheetlib.PygameSurfaceMock(blit_rects, fill_rects, name)[source]

Bases: object

The pygame surface mock.

Parameters:
  • blit_rects – The rects returned by the blit method.
  • fill_rects – The rects returned by the fill method.
  • name – The name of the surface, more of an identifier, makes it easier to match the correct surface mocks.
blit(source, destination, area=None, special_flags=0)[source]
fill(color, rect=None, special_flags=0)[source]
class tests.test_spritesheetlib.SpritesheetLib10SpecialMock(sprites, sdef, the_logger)[source]

Bases: spritesheetlib.spritesheetlib.SpritesheetLib10

The special mock to log the call to ‘load_spritesheet_from_sdef’.

Parameters:the_logger – The logger instance to use.
load_sdef_from_file(*args)[source]
load_spritesheet_from_sdef(*args)[source]
class tests.test_spritesheetlib.TestAABB(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_aabb_are_equal()[source]
test_aabb_are_not_equal()[source]
test_aabb_are_not_equal_false()[source]
test_aabb_collide_all()[source]
test_aabb_collision_DDT_args__11__11__20__20__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__11__1__20__9__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__12__6__19__9__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__19__10__30__13__False_(v, w, x, y, expected)
test_aabb_collision_DDT_args__1__10__3__13__False_(v, w, x, y, expected)
test_aabb_collision_DDT_args__1__11__9__20__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__1__1__3__3__False_(v, w, x, y, expected)
test_aabb_collision_DDT_args__1__1__9__9__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__2__6__10__9__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__2__6__20__9__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__6__12__9__19__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__6__2__9__10__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__6__2__9__20__True_(v, w, x, y, expected)
test_aabb_collision_DDT_args__7__19__9__33__False_(v, w, x, y, expected)
test_aabb_equal_to_other_type()[source]
test_aabb_from_points()[source]
test_aabb_min_max()[source]
test_aabb_move()[source]
test_aabb_move_ip()[source]
test_aabb_move_ip_center()[source]
test_aabb_not_equal_to_other_type()[source]
test_aabb_wrong_value_order_x()[source]
test_aabb_wrong_value_order_y()[source]
test_copy()[source]
test_copy_from()[source]
test_repr()[source]
test_str()[source]
test_to_rect_tuple()[source]
test_union()[source]
test_union2()[source]
test_union_all()[source]
class tests.test_spritesheetlib.TestData[source]

Bases: object

Contains all sprite definitions used for testing (valid and invalid ones).

SDEF_EXTREME_OVERLAPPING = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[5, 0], [64, 0], [64, 10], [5, 10]]}, {'gid': '002', 'points': [[10, 3], [40, 3], [40, 15], [10, 15]]}, {'gid': '003', 'points': [[64, 0], [71, 0], [71, 67], [64, 67]]}]}
SDEF_EXTREME_OVERLAPPING_MARGIN10 = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[10, 10], [42, 10], [42, 15], [10, 15]]}, {'gid': '001', 'points': [[15, 10], [74, 10], [74, 20], [15, 20]]}, {'gid': '002', 'points': [[20, 13], [50, 13], [50, 25], [20, 25]]}, {'gid': '003', 'points': [[74, 10], [81, 10], [81, 77], [74, 77]]}]}
SDEF_EXTREME_OVERLAPPING_SPACING5 = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[37, 0], [96, 0], [96, 10], [37, 10]]}, {'gid': '002', 'points': [[40, 15], [70, 15], [70, 27], [40, 27]]}, {'gid': '003', 'points': [[101, 0], [108, 0], [108, 67], [101, 67]]}]}
SDEF_GRID_10X10 = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 32], [0, 32]]}, {'gid': '001', 'points': [[32, 0], [64, 0], [64, 32], [32, 32]]}, {'gid': '002', 'points': [[64, 0], [96, 0], [96, 32], [64, 32]]}, {'gid': '003', 'points': [[96, 0], [128, 0], [128, 32], [96, 32]]}, {'gid': '004', 'points': [[128, 0], [160, 0], [160, 32], [128, 32]]}, {'gid': '005', 'points': [[160, 0], [192, 0], [192, 32], [160, 32]]}, {'gid': '006', 'points': [[192, 0], [224, 0], [224, 32], [192, 32]]}, {'gid': '007', 'points': [[224, 0], [256, 0], [256, 32], [224, 32]]}, {'gid': '008', 'points': [[256, 0], [288, 0], [288, 32], [256, 32]]}, {'gid': '009', 'points': [[288, 0], [320, 0], [320, 32], [288, 32]]}, {'gid': '010', 'points': [[0, 32], [32, 32], [32, 64], [0, 64]]}, {'gid': '011', 'points': [[32, 32], [64, 32], [64, 64], [32, 64]]}, {'gid': '012', 'points': [[64, 32], [96, 32], [96, 64], [64, 64]]}, {'gid': '013', 'points': [[96, 32], [128, 32], [128, 64], [96, 64]]}, {'gid': '014', 'points': [[128, 32], [160, 32], [160, 64], [128, 64]]}, {'gid': '015', 'points': [[160, 32], [192, 32], [192, 64], [160, 64]]}, {'gid': '016', 'points': [[192, 32], [224, 32], [224, 64], [192, 64]]}, {'gid': '017', 'points': [[224, 32], [256, 32], [256, 64], [224, 64]]}, {'gid': '018', 'points': [[256, 32], [288, 32], [288, 64], [256, 64]]}, {'gid': '019', 'points': [[288, 32], [320, 32], [320, 64], [288, 64]]}, {'gid': '020', 'points': [[0, 64], [32, 64], [32, 96], [0, 96]]}, {'gid': '021', 'points': [[32, 64], [64, 64], [64, 96], [32, 96]]}, {'gid': '022', 'points': [[64, 64], [96, 64], [96, 96], [64, 96]]}, {'gid': '023', 'points': [[96, 64], [128, 64], [128, 96], [96, 96]]}, {'gid': '024', 'points': [[128, 64], [160, 64], [160, 96], [128, 96]]}, {'gid': '025', 'points': [[160, 64], [192, 64], [192, 96], [160, 96]]}, {'gid': '026', 'points': [[192, 64], [224, 64], [224, 96], [192, 96]]}, {'gid': '027', 'points': [[224, 64], [256, 64], [256, 96], [224, 96]]}, {'gid': '028', 'points': [[256, 64], [288, 64], [288, 96], [256, 96]]}, {'gid': '029', 'points': [[288, 64], [320, 64], [320, 96], [288, 96]]}, {'gid': '030', 'points': [[0, 96], [32, 96], [32, 128], [0, 128]]}, {'gid': '031', 'points': [[32, 96], [64, 96], [64, 128], [32, 128]]}, {'gid': '032', 'points': [[64, 96], [96, 96], [96, 128], [64, 128]]}, {'gid': '033', 'points': [[96, 96], [128, 96], [128, 128], [96, 128]]}, {'gid': '034', 'points': [[128, 96], [160, 96], [160, 128], [128, 128]]}, {'gid': '035', 'points': [[160, 96], [192, 96], [192, 128], [160, 128]]}, {'gid': '036', 'points': [[192, 96], [224, 96], [224, 128], [192, 128]]}, {'gid': '037', 'points': [[224, 96], [256, 96], [256, 128], [224, 128]]}, {'gid': '038', 'points': [[256, 96], [288, 96], [288, 128], [256, 128]]}, {'gid': '039', 'points': [[288, 96], [320, 96], [320, 128], [288, 128]]}, {'gid': '040', 'points': [[0, 128], [32, 128], [32, 160], [0, 160]]}, {'gid': '041', 'points': [[32, 128], [64, 128], [64, 160], [32, 160]]}, {'gid': '042', 'points': [[64, 128], [96, 128], [96, 160], [64, 160]]}, {'gid': '043', 'points': [[96, 128], [128, 128], [128, 160], [96, 160]]}, {'gid': '044', 'points': [[128, 128], [160, 128], [160, 160], [128, 160]]}, {'gid': '045', 'points': [[160, 128], [192, 128], [192, 160], [160, 160]]}, {'gid': '046', 'points': [[192, 128], [224, 128], [224, 160], [192, 160]]}, {'gid': '047', 'points': [[224, 128], [256, 128], [256, 160], [224, 160]]}, {'gid': '048', 'points': [[256, 128], [288, 128], [288, 160], [256, 160]]}, {'gid': '049', 'points': [[288, 128], [320, 128], [320, 160], [288, 160]]}, {'gid': '050', 'points': [[0, 160], [32, 160], [32, 192], [0, 192]]}, {'gid': '051', 'points': [[32, 160], [64, 160], [64, 192], [32, 192]]}, {'gid': '052', 'points': [[64, 160], [96, 160], [96, 192], [64, 192]]}, {'gid': '053', 'points': [[96, 160], [128, 160], [128, 192], [96, 192]]}, {'gid': '054', 'points': [[128, 160], [160, 160], [160, 192], [128, 192]]}, {'gid': '055', 'points': [[160, 160], [192, 160], [192, 192], [160, 192]]}, {'gid': '056', 'points': [[192, 160], [224, 160], [224, 192], [192, 192]]}, {'gid': '057', 'points': [[224, 160], [256, 160], [256, 192], [224, 192]]}, {'gid': '058', 'points': [[256, 160], [288, 160], [288, 192], [256, 192]]}, {'gid': '059', 'points': [[288, 160], [320, 160], [320, 192], [288, 192]]}, {'gid': '060', 'points': [[0, 192], [32, 192], [32, 224], [0, 224]]}, {'gid': '061', 'points': [[32, 192], [64, 192], [64, 224], [32, 224]]}, {'gid': '062', 'points': [[64, 192], [96, 192], [96, 224], [64, 224]]}, {'gid': '063', 'points': [[96, 192], [128, 192], [128, 224], [96, 224]]}, {'gid': '064', 'points': [[128, 192], [160, 192], [160, 224], [128, 224]]}, {'gid': '065', 'points': [[160, 192], [192, 192], [192, 224], [160, 224]]}, {'gid': '066', 'points': [[192, 192], [224, 192], [224, 224], [192, 224]]}, {'gid': '067', 'points': [[224, 192], [256, 192], [256, 224], [224, 224]]}, {'gid': '068', 'points': [[256, 192], [288, 192], [288, 224], [256, 224]]}, {'gid': '069', 'points': [[288, 192], [320, 192], [320, 224], [288, 224]]}, {'gid': '070', 'points': [[0, 224], [32, 224], [32, 256], [0, 256]]}, {'gid': '071', 'points': [[32, 224], [64, 224], [64, 256], [32, 256]]}, {'gid': '072', 'points': [[64, 224], [96, 224], [96, 256], [64, 256]]}, {'gid': '073', 'points': [[96, 224], [128, 224], [128, 256], [96, 256]]}, {'gid': '074', 'points': [[128, 224], [160, 224], [160, 256], [128, 256]]}, {'gid': '075', 'points': [[160, 224], [192, 224], [192, 256], [160, 256]]}, {'gid': '076', 'points': [[192, 224], [224, 224], [224, 256], [192, 256]]}, {'gid': '077', 'points': [[224, 224], [256, 224], [256, 256], [224, 256]]}, {'gid': '078', 'points': [[256, 224], [288, 224], [288, 256], [256, 256]]}, {'gid': '079', 'points': [[288, 224], [320, 224], [320, 256], [288, 256]]}, {'gid': '080', 'points': [[0, 256], [32, 256], [32, 288], [0, 288]]}, {'gid': '081', 'points': [[32, 256], [64, 256], [64, 288], [32, 288]]}, {'gid': '082', 'points': [[64, 256], [96, 256], [96, 288], [64, 288]]}, {'gid': '083', 'points': [[96, 256], [128, 256], [128, 288], [96, 288]]}, {'gid': '084', 'points': [[128, 256], [160, 256], [160, 288], [128, 288]]}, {'gid': '085', 'points': [[160, 256], [192, 256], [192, 288], [160, 288]]}, {'gid': '086', 'points': [[192, 256], [224, 256], [224, 288], [192, 288]]}, {'gid': '087', 'points': [[224, 256], [256, 256], [256, 288], [224, 288]]}, {'gid': '088', 'points': [[256, 256], [288, 256], [288, 288], [256, 288]]}, {'gid': '089', 'points': [[288, 256], [320, 256], [320, 288], [288, 288]]}, {'gid': '090', 'points': [[0, 288], [32, 288], [32, 320], [0, 320]]}, {'gid': '091', 'points': [[32, 288], [64, 288], [64, 320], [32, 320]]}, {'gid': '092', 'points': [[64, 288], [96, 288], [96, 320], [64, 320]]}, {'gid': '093', 'points': [[96, 288], [128, 288], [128, 320], [96, 320]]}, {'gid': '094', 'points': [[128, 288], [160, 288], [160, 320], [128, 320]]}, {'gid': '095', 'points': [[160, 288], [192, 288], [192, 320], [160, 320]]}, {'gid': '096', 'points': [[192, 288], [224, 288], [224, 320], [192, 320]]}, {'gid': '097', 'points': [[224, 288], [256, 288], [256, 320], [224, 320]]}, {'gid': '098', 'points': [[256, 288], [288, 288], [288, 320], [256, 320]]}, {'gid': '099', 'points': [[288, 288], [320, 288], [320, 320], [288, 320]]}]}
SDEF_GRID_10X10_SPACE_50 = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 32], [0, 32]]}, {'gid': '001', 'points': [[82, 0], [114, 0], [114, 32], [82, 32]]}, {'gid': '002', 'points': [[164, 0], [196, 0], [196, 32], [164, 32]]}, {'gid': '003', 'points': [[246, 0], [278, 0], [278, 32], [246, 32]]}, {'gid': '004', 'points': [[328, 0], [360, 0], [360, 32], [328, 32]]}, {'gid': '005', 'points': [[410, 0], [442, 0], [442, 32], [410, 32]]}, {'gid': '006', 'points': [[492, 0], [524, 0], [524, 32], [492, 32]]}, {'gid': '007', 'points': [[574, 0], [606, 0], [606, 32], [574, 32]]}, {'gid': '008', 'points': [[656, 0], [688, 0], [688, 32], [656, 32]]}, {'gid': '009', 'points': [[738, 0], [770, 0], [770, 32], [738, 32]]}, {'gid': '010', 'points': [[0, 82], [32, 82], [32, 114], [0, 114]]}, {'gid': '011', 'points': [[82, 82], [114, 82], [114, 114], [82, 114]]}, {'gid': '012', 'points': [[164, 82], [196, 82], [196, 114], [164, 114]]}, {'gid': '013', 'points': [[246, 82], [278, 82], [278, 114], [246, 114]]}, {'gid': '014', 'points': [[328, 82], [360, 82], [360, 114], [328, 114]]}, {'gid': '015', 'points': [[410, 82], [442, 82], [442, 114], [410, 114]]}, {'gid': '016', 'points': [[492, 82], [524, 82], [524, 114], [492, 114]]}, {'gid': '017', 'points': [[574, 82], [606, 82], [606, 114], [574, 114]]}, {'gid': '018', 'points': [[656, 82], [688, 82], [688, 114], [656, 114]]}, {'gid': '019', 'points': [[738, 82], [770, 82], [770, 114], [738, 114]]}, {'gid': '020', 'points': [[0, 164], [32, 164], [32, 196], [0, 196]]}, {'gid': '021', 'points': [[82, 164], [114, 164], [114, 196], [82, 196]]}, {'gid': '022', 'points': [[164, 164], [196, 164], [196, 196], [164, 196]]}, {'gid': '023', 'points': [[246, 164], [278, 164], [278, 196], [246, 196]]}, {'gid': '024', 'points': [[328, 164], [360, 164], [360, 196], [328, 196]]}, {'gid': '025', 'points': [[410, 164], [442, 164], [442, 196], [410, 196]]}, {'gid': '026', 'points': [[492, 164], [524, 164], [524, 196], [492, 196]]}, {'gid': '027', 'points': [[574, 164], [606, 164], [606, 196], [574, 196]]}, {'gid': '028', 'points': [[656, 164], [688, 164], [688, 196], [656, 196]]}, {'gid': '029', 'points': [[738, 164], [770, 164], [770, 196], [738, 196]]}, {'gid': '030', 'points': [[0, 246], [32, 246], [32, 278], [0, 278]]}, {'gid': '031', 'points': [[82, 246], [114, 246], [114, 278], [82, 278]]}, {'gid': '032', 'points': [[164, 246], [196, 246], [196, 278], [164, 278]]}, {'gid': '033', 'points': [[246, 246], [278, 246], [278, 278], [246, 278]]}, {'gid': '034', 'points': [[328, 246], [360, 246], [360, 278], [328, 278]]}, {'gid': '035', 'points': [[410, 246], [442, 246], [442, 278], [410, 278]]}, {'gid': '036', 'points': [[492, 246], [524, 246], [524, 278], [492, 278]]}, {'gid': '037', 'points': [[574, 246], [606, 246], [606, 278], [574, 278]]}, {'gid': '038', 'points': [[656, 246], [688, 246], [688, 278], [656, 278]]}, {'gid': '039', 'points': [[738, 246], [770, 246], [770, 278], [738, 278]]}, {'gid': '040', 'points': [[0, 328], [32, 328], [32, 360], [0, 360]]}, {'gid': '041', 'points': [[82, 328], [114, 328], [114, 360], [82, 360]]}, {'gid': '042', 'points': [[164, 328], [196, 328], [196, 360], [164, 360]]}, {'gid': '043', 'points': [[246, 328], [278, 328], [278, 360], [246, 360]]}, {'gid': '044', 'points': [[328, 328], [360, 328], [360, 360], [328, 360]]}, {'gid': '045', 'points': [[410, 328], [442, 328], [442, 360], [410, 360]]}, {'gid': '046', 'points': [[492, 328], [524, 328], [524, 360], [492, 360]]}, {'gid': '047', 'points': [[574, 328], [606, 328], [606, 360], [574, 360]]}, {'gid': '048', 'points': [[656, 328], [688, 328], [688, 360], [656, 360]]}, {'gid': '049', 'points': [[738, 328], [770, 328], [770, 360], [738, 360]]}, {'gid': '050', 'points': [[0, 410], [32, 410], [32, 442], [0, 442]]}, {'gid': '051', 'points': [[82, 410], [114, 410], [114, 442], [82, 442]]}, {'gid': '052', 'points': [[164, 410], [196, 410], [196, 442], [164, 442]]}, {'gid': '053', 'points': [[246, 410], [278, 410], [278, 442], [246, 442]]}, {'gid': '054', 'points': [[328, 410], [360, 410], [360, 442], [328, 442]]}, {'gid': '055', 'points': [[410, 410], [442, 410], [442, 442], [410, 442]]}, {'gid': '056', 'points': [[492, 410], [524, 410], [524, 442], [492, 442]]}, {'gid': '057', 'points': [[574, 410], [606, 410], [606, 442], [574, 442]]}, {'gid': '058', 'points': [[656, 410], [688, 410], [688, 442], [656, 442]]}, {'gid': '059', 'points': [[738, 410], [770, 410], [770, 442], [738, 442]]}, {'gid': '060', 'points': [[0, 492], [32, 492], [32, 524], [0, 524]]}, {'gid': '061', 'points': [[82, 492], [114, 492], [114, 524], [82, 524]]}, {'gid': '062', 'points': [[164, 492], [196, 492], [196, 524], [164, 524]]}, {'gid': '063', 'points': [[246, 492], [278, 492], [278, 524], [246, 524]]}, {'gid': '064', 'points': [[328, 492], [360, 492], [360, 524], [328, 524]]}, {'gid': '065', 'points': [[410, 492], [442, 492], [442, 524], [410, 524]]}, {'gid': '066', 'points': [[492, 492], [524, 492], [524, 524], [492, 524]]}, {'gid': '067', 'points': [[574, 492], [606, 492], [606, 524], [574, 524]]}, {'gid': '068', 'points': [[656, 492], [688, 492], [688, 524], [656, 524]]}, {'gid': '069', 'points': [[738, 492], [770, 492], [770, 524], [738, 524]]}, {'gid': '070', 'points': [[0, 574], [32, 574], [32, 606], [0, 606]]}, {'gid': '071', 'points': [[82, 574], [114, 574], [114, 606], [82, 606]]}, {'gid': '072', 'points': [[164, 574], [196, 574], [196, 606], [164, 606]]}, {'gid': '073', 'points': [[246, 574], [278, 574], [278, 606], [246, 606]]}, {'gid': '074', 'points': [[328, 574], [360, 574], [360, 606], [328, 606]]}, {'gid': '075', 'points': [[410, 574], [442, 574], [442, 606], [410, 606]]}, {'gid': '076', 'points': [[492, 574], [524, 574], [524, 606], [492, 606]]}, {'gid': '077', 'points': [[574, 574], [606, 574], [606, 606], [574, 606]]}, {'gid': '078', 'points': [[656, 574], [688, 574], [688, 606], [656, 606]]}, {'gid': '079', 'points': [[738, 574], [770, 574], [770, 606], [738, 606]]}, {'gid': '080', 'points': [[0, 656], [32, 656], [32, 688], [0, 688]]}, {'gid': '081', 'points': [[82, 656], [114, 656], [114, 688], [82, 688]]}, {'gid': '082', 'points': [[164, 656], [196, 656], [196, 688], [164, 688]]}, {'gid': '083', 'points': [[246, 656], [278, 656], [278, 688], [246, 688]]}, {'gid': '084', 'points': [[328, 656], [360, 656], [360, 688], [328, 688]]}, {'gid': '085', 'points': [[410, 656], [442, 656], [442, 688], [410, 688]]}, {'gid': '086', 'points': [[492, 656], [524, 656], [524, 688], [492, 688]]}, {'gid': '087', 'points': [[574, 656], [606, 656], [606, 688], [574, 688]]}, {'gid': '088', 'points': [[656, 656], [688, 656], [688, 688], [656, 688]]}, {'gid': '089', 'points': [[738, 656], [770, 656], [770, 688], [738, 688]]}, {'gid': '090', 'points': [[0, 738], [32, 738], [32, 770], [0, 770]]}, {'gid': '091', 'points': [[82, 738], [114, 738], [114, 770], [82, 770]]}, {'gid': '092', 'points': [[164, 738], [196, 738], [196, 770], [164, 770]]}, {'gid': '093', 'points': [[246, 738], [278, 738], [278, 770], [246, 770]]}, {'gid': '094', 'points': [[328, 738], [360, 738], [360, 770], [328, 770]]}, {'gid': '095', 'points': [[410, 738], [442, 738], [442, 770], [410, 770]]}, {'gid': '096', 'points': [[492, 738], [524, 738], [524, 770], [492, 770]]}, {'gid': '097', 'points': [[574, 738], [606, 738], [606, 770], [574, 770]]}, {'gid': '098', 'points': [[656, 738], [688, 738], [688, 770], [656, 770]]}, {'gid': '099', 'points': [[738, 738], [770, 738], [770, 770], [738, 770]]}]}
SDEF_GRID_2X2 = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': 0, 'points': [[0, 0], [32, 0], [32, 32], [0, 32]], 'anchor': [10, 10], 'properties': {'row': 0, 'col': 0}}, {'gid': 1, 'points': [[32, 0], [64, 0], [64, 32], [32, 32]], 'properties': {'row': 0, 'col': 1}}, {'gid': 2, 'points': [[0, 32], [32, 32], [32, 64], [0, 64]], 'properties': {'row': 1, 'col': 0}}, {'gid': 3, 'points': [[32, 32], [64, 32], [64, 64], [32, 64]], 'properties': {'row': 1, 'col': 1}}]}
SDEF_GRID_2X2_MARGIN_33 = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': 0, 'anchor': [10, 10], 'points': [[33, 33], [65, 33], [65, 65], [33, 65]], 'properties': {'row': 0, 'col': 0}}, {'gid': 1, 'points': [[65, 33], [97, 33], [97, 65], [65, 65]], 'properties': {'row': 0, 'col': 1}}, {'gid': 2, 'points': [[33, 65], [65, 65], [65, 97], [33, 97]], 'properties': {'row': 1, 'col': 0}}, {'gid': 3, 'points': [[65, 65], [97, 65], [97, 97], [65, 97]], 'properties': {'row': 1, 'col': 1}}]}
SDEF_GRID_2X2_SPECIAL_MARGIN = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 32], [0, 32]]}, {'gid': '001', 'points': [[32, -13], [64, -13], [64, 32], [32, 32]]}, {'gid': '002', 'points': [[-17, 32], [32, 32], [32, 64], [-17, 64]]}, {'gid': '003', 'points': [[32, 32], [64, 32], [64, 64], [32, 64]]}]}
SDEF_GRID_2X2_SPECIAL_MARGIN_5 = {'version': '1.0', 'filename': 'out.png.sdef', 'sprites': [{'gid': '000', 'points': [[22, 18], [54, 18], [54, 50], [22, 50]]}, {'gid': '001', 'points': [[54, 5], [86, 5], [86, 50], [54, 50]]}, {'gid': '002', 'points': [[5, 50], [54, 50], [54, 82], [5, 82]]}, {'gid': '003', 'points': [[54, 50], [86, 50], [86, 82], [54, 82]]}]}
SDEF_GRID_2X2_TEST = {'version': '1.0', 'filename': 'test.sdef.png.sdef', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 32], [0, 32]]}, {'gid': '001', 'points': [[32, 0], [64, 0], [64, 32], [32, 32]]}, {'gid': '002', 'points': [[0, 32], [32, 32], [32, 64], [0, 64]]}, {'gid': '003', 'points': [[32, 32], [64, 32], [64, 64], [32, 64]]}]}
SDEF_INVALID_COLINEAR_2_POINTS_SAME = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[32, 5], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[32, 5], [0, 5], [2, 3]]}]}
SDEF_INVALID_COLINEAR_3_POINTS_SAME = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[5, 5], [5, 5], [5, 5]]}, {'gid': '001', 'points': [[32, 5], [0, 5], [2, 3]]}]}
SDEF_INVALID_COLINEAR_COORDINATES_POLYGON = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[1, 1], [2, 2], [5, 5], [10, 10], [55, 55], [15, 15]]}, {'gid': '001', 'points': [[32, 5], [0, 5], [2, 3]]}]}
SDEF_INVALID_COLINEAR_COORDINATES_TRIANGLE = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[10, 10], [5, 5], [15, 15]]}, {'gid': '001', 'points': [[32, 5], [0, 5], [2, 3]]}]}
SDEF_INVALID_DUPLICATE_NAMES = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '000', 'points': [[37, 0], [96, 0], [96, 10], [37, 10]]}]}
SDEF_INVALID_FILENAME_EMPTY = {'version': '1.0', 'filename': '', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[10, 10], [42, 10], [42, 15], [10, 15]]}]}
SDEF_INVALID_INCONSISTENT_ORIENTATION = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '001', 'points': [[136, 0], [143, 10], [143, 67], [136, 67]]}, {'gid': '002', 'points': [[136, 67], [143, 67], [143, 10], [136, 0]]}, {'gid': '003', 'points': [[136, 0], [143, 10], [143, 67], [136, 67]]}]}
SDEF_INVALID_MISSING_FILENAME = {'version': '1.0', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[10, 10], [42, 10], [42, 15], [10, 15]]}]}
SDEF_INVALID_MISSING_POINTS = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001'}]}
SDEF_INVALID_MISSING_POINT_COORDINATES = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'gid': '001', 'points': [[32, 5], [0, 5]]}]}
SDEF_INVALID_MISSING_SPRITES = {'version': '1.0', 'filename': 'x.png'}
SDEF_INVALID_MISSING_SPRITES_LIST_EMPTY = {'version': '1.0', 'filename': 'x.png', 'sprites': []}
SDEF_INVALID_MISSING_SPRITE_NAME = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}, {'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}]}
SDEF_INVALID_MISSING_VERSION = {'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}]}
SDEF_INVALID_NEGATIVE_X_COORDINATES = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '003', 'points': [[136, 0], [143, 10], [-143, 67], [136, 67]]}]}
SDEF_INVALID_NEGATIVE_Y_COORDINATES = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '003', 'points': [[136, 0], [143, -10], [143, 67], [136, 67]]}]}
SDEF_INVALID_VERSION = {'version': '0.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [32, 5], [0, 5]]}]}
SDEF_OVERLAPPING_SPACING0 = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [0, 32]]}, {'gid': '001', 'points': [[36, 0], [68, 0], [36, 32], [32, 16]]}, {'gid': '002', 'points': [[0, 36], [28, 32], [36, 68], [0, 68]]}, {'gid': '003', 'points': [[36, 32], [68, 38], [68, 64], [52, 48]]}]}
SDEF_OVERLAPPING_SPACING3 = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [0, 32]]}, {'gid': '001', 'points': [[39, 0], [71, 0], [39, 32], [35, 16]]}, {'gid': '002', 'points': [[0, 39], [28, 35], [36, 71], [0, 71]]}, {'gid': '003', 'points': [[39, 35], [71, 41], [71, 67], [55, 51]]}]}
SDEF_OVERLAPPING_SPRITES = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[0, 0], [32, 0], [0, 32]]}, {'gid': '001', 'points': [[32, 0], [64, 0], [32, 32], [28, 16]]}, {'gid': '002', 'points': [[0, 32], [28, 28], [36, 64], [0, 64]]}, {'gid': '003', 'points': [[32, 32], [64, 38], [64, 64], [48, 48]]}]}
SDEF_WARN_2_POINTS_SAME_IN_POLYGON = {'version': '1.0', 'filename': 'x.png', 'sprites': [{'gid': '000', 'points': [[32, 5], [0, 5], [0, 20], [32, 5], [10, 6]]}, {'gid': '001', 'points': [[32, 5], [0, 5], [2, 30]]}]}
class tests.test_spritesheetlib.TestFileInfo(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
tearDown()[source]
test_directory_is_passed()[source]
test_directory_name_property()[source]
test_directory_name_property_case()[source]
test_fi_are_equal()[source]
test_fi_are_not_equal()[source]
test_fi_equal_to_other_type()[source]
test_fi_fullname()[source]
test_fi_fullname_case()[source]
test_fi_fullname_normpath()[source]
test_fi_not_equal_false()[source]
test_fi_not_equal_to_other_type()[source]
test_file_does_exist_with_correct_casing()[source]
test_file_does_exists()[source]
test_file_does_not_exists()[source]
test_file_info_accepts_file_without_extension()[source]
test_file_info_delete()[source]
test_file_info_does_not_accept_a_directory_path()[source]
test_file_info_does_not_accept_a_directory_path_with_altsep()[source]
test_file_info_does_not_accept_a_directory_path_with_pardir()[source]
test_file_info_does_not_accept_a_directory_path_with_sep()[source]
test_file_info_raises_if_file_name_contains_pathsep()[source]
test_file_info_raises_on_null_path()[source]
test_io_error_is_raised_for_non_existing()[source]
test_is_casing_different_False()[source]
test_is_casing_different_False_no_exists()[source]
test_is_casing_different_True()[source]
test_is_casing_different_True_no_exists()[source]
test_name_property()[source]
test_open_read_using_mode_DDT_args___rU___(mode)
test_open_read_using_mode_DDT_args___r___(mode)
test_open_read_using_mode_DDT_args___r____(mode)
test_open_read_using_mode_DDT_args___rt___(mode)
test_open_read_using_mode_binary_DDT_args___r_b___(mode)
test_open_read_using_mode_binary_DDT_args___rb___(mode)
test_open_write_with_mode_DDT_args___a___(mode)
test_open_write_with_mode_DDT_args___a____(mode)
test_open_write_with_mode_DDT_args___w___(mode)
test_open_write_with_mode_DDT_args___w____(mode)
test_open_write_with_mode_DDT_args___wt___(mode)
test_open_write_with_mode_binary_DDT_args___a_b___(mode)
test_open_write_with_mode_binary_DDT_args___ab___(mode)
test_open_write_with_mode_binary_DDT_args___w_b___(mode)
test_open_write_with_mode_binary_DDT_args___wb___(mode)
test_repr()[source]
test_str()[source]
class tests.test_spritesheetlib.TestFileInfoMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_mock_exist_returns_false()[source]
test_mock_exist_returns_true()[source]
test_read_from_file()[source]
test_write_to_file()[source]
class tests.test_spritesheetlib.TestFileInfoOpen(methodName='runTest')[source]

Bases: unittest.case.TestCase

mocked_open(*args)[source]
reset_builtin()[source]
setUp()[source]
tearDown()[source]
test_open_different_casing()[source]
test_open_same_casing()[source]
class tests.test_spritesheetlib.TestFindDefiningClass(methodName='runTest')[source]

Bases: unittest.case.TestCase

This tests test the working of the function ‘find_defining_class’.

test_find_defining_class()[source]
class tests.test_spritesheetlib.TestGridCommand(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_simple_grid_generation()[source]
class tests.test_spritesheetlib.TestImageGeneration(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_image_is_created()[source]
test_image_with_margin_is_created()[source]
class tests.test_spritesheetlib.TestJsonMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_load()[source]
test_loads()[source]
class tests.test_spritesheetlib.TestLoggerMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_log_level_critical()[source]
test_log_level_debug()[source]
test_log_level_error()[source]
test_log_level_info()[source]
test_log_level_warn()[source]
class tests.test_spritesheetlib.TestNeededDigitsFromValue(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_negative_values_raise_ValueError()[source]
test_non_int_raises_TypeError()[source]
test_value_10()[source]
test_value_100()[source]
test_value_1000()[source]
test_value_10000()[source]
test_value_9()[source]
test_zero()[source]
class tests.test_spritesheetlib.TestOsModuleMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_listdir()[source]
test_remove()[source]
class tests.test_spritesheetlib.TestOsPathMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_directory_name()[source]
test_exists_false()[source]
test_exists_true()[source]
test_is_dir_false()[source]
test_is_dir_true()[source]
test_split()[source]
class tests.test_spritesheetlib.TestPolygon(methodName='runTest')[source]

Bases: unittest.case.TestCase

points = [[0, 0], [10, 0], [10, 10], [0, 10]]
test_area_clockwise()[source]
test_area_counterclockwise()[source]
test_get_orientation_clockwise()[source]
test_get_orientation_counter_clockwise()[source]
test_sign_negative()[source]
test_sign_positive()[source]
test_sign_zero()[source]
test_signed_area_negative()[source]
test_signed_area_positive()[source]
class tests.test_spritesheetlib.TestPygameDrawModuleMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_polygon()[source]
class tests.test_spritesheetlib.TestPygameImageModuleMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_load()[source]
test_save()[source]
class tests.test_spritesheetlib.TestPygameMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_draw_module_retrieval()[source]
test_image_module_retrieval()[source]
test_rect_creation()[source]
test_surface_creation()[source]
class tests.test_spritesheetlib.TestPygameRectMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_get_size_property()[source]
test_name_str()[source]
test_name_string()[source]
test_set_size_property()[source]
class tests.test_spritesheetlib.TestPygameSurfaceMock(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_blit()[source]
test_fill()[source]
test_name_str()[source]
test_name_string()[source]
class tests.test_spritesheetlib.TestRemoveFile(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_remove_but_file_still_exists()[source]
test_remove_existing_file()[source]
test_remove_fails()[source]
class tests.test_spritesheetlib.TestSpriteDefinitionGeneration(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_margin_0()[source]
test_margin_x()[source]
test_negative_margin_raises_ValueError()[source]
test_new_sprite_definition_is_a_different_instance()[source]
test_simple_grid_sprite_definition_generation_DDT_args____version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1________version____1_0____filename____out_png_sdef____sprites______gid___0___points_____0__0____32__0____32__32____0__32_____anchor____10__10____properties_____row___0___col___0______gid___1___points_____32__0____64__0____64__32____32__32_____properties_____row___0___col___1______gid___2___points_____0__32____32__32____32__64____0__64_____properties_____row___1___col___0______gid___3___points_____32__32____64__32____64__64____32__64_____properties_____row___1___col___1_____(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_grid_10x10_spacing50(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_extreme_margin_10(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_extreme_no_spacing(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_extreme_spacing_5(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_spacing_0(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_spacing_3(expected, sdef, spacing=None, margin=0)
test_simple_grid_sprite_definition_generation_DDT_overlapping_spacing__1(expected, sdef, spacing=None, margin=0)
test_special_aabb_margin_5()[source]
class tests.test_spritesheetlib.TestSpriteDefinitionValidation(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_is_valid()[source]
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_COLINEAR_2_POINTS_SAME(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_COLINEAR_3_POINTS_SAME(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_COLINEAR_COORDINATES_POLYGON(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_COLINEAR_COORDINATES_TRIANGLE(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_DUPLICATE_NAMES(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_FILENAME_EMPTY(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_INCONSISTENT_ORIENTATION(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_FILENAME(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_POINTS(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_POINT_COORDINATES(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_SPRITES(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_SPRITES_LIST_EMPTY(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_SPRITE_NAME(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_MISSING_VERSION(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_NEGATIVE_X_COORDINATES(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_NEGATIVE_Y_COORDINATES(sdef)
test_sprite_definition_is_invalid_DDT_TestData_SDEF_INVALID_VERSION(sdef)
test_sprite_definition_is_invalid_if_None()[source]
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_COLINEAR_2_POINTS_SAME(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_COLINEAR_3_POINTS_SAME(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_COLINEAR_COORDINATES_POLYGON(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_COLINEAR_COORDINATES_TRIANGLE(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_DUPLICATE_NAMES(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_FILENAME_EMPTY(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_INCONSISTENT_ORIENTATION(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_FILENAME(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_POINTS(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_POINT_COORDINATES(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_SPRITES(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_SPRITES_LIST_EMPTY(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_SPRITE_NAME(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_MISSING_VERSION(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_NEGATIVE_X_COORDINATES(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_NEGATIVE_Y_COORDINATES(sdef)
test_sprite_definition_is_invalid_logs_error_message_DDT_TestData_SDEF_INVALID_VERSION(sdef)
test_sprite_definition_logs_warning()[source]
class tests.test_spritesheetlib.TestSpritesList(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_create_empty_instance()[source]
test_create_instance_with_entries()[source]
test_get_cols()[source]
test_get_cols_fail_while_row_prop_is_missing()[source]
test_get_cols_with_gap()[source]
test_get_gid_slice()[source]
test_get_grouped_by_action_and_facing()[source]
test_get_grouped_by_action_and_facing_fails_missing_facing()[source]
test_get_grouped_by_action_and_facing_some_missing()[source]
test_get_grouped_by_facing_and_action()[source]
test_get_grouped_by_facing_and_action_fails_missing_action()[source]
test_get_grouped_by_facing_and_action_some_missing()[source]
test_get_grouped_by_property()[source]
test_get_row_with_gap()[source]
test_get_rows()[source]
test_get_rows_fail_while_col_prop_is_missing()[source]
class tests.test_spritesheetlib.TestSpritesheetLib10UpdateProperties(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_mode_extend()[source]
test_mode_extend_strict_ok()[source]
test_mode_extend_strict_raises_on_missing_gid()[source]
test_mode_update_missing_key_does_not_raise()[source]
test_mode_update_strict_missing_key_raise()[source]
test_mode_update_strict_no_missing_key()[source]
test_properties_mode_only_accepts_valid_mode_value_DDT_mode_extend(mode)
test_properties_mode_only_accepts_valid_mode_value_DDT_mode_extend_strict(mode)
test_properties_mode_only_accepts_valid_mode_value_DDT_mode_update(mode)
test_properties_mode_only_accepts_valid_mode_value_DDT_mode_update_strict(mode)
test_properties_mode_wrong_value_raises_value_error()[source]
test_update_properties_need_key_mode()[source]
class tests.test_spritesheetlib.TestSpritesheetLibLoadingSpriteDefinition(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_get_image_name_from_sdef()[source]
test_get_image_name_from_sdef_missing_extension()[source]
test_get_image_name_from_sdef_name()[source]
test_get_image_name_from_sdef_name_missing_extension()[source]
test_load_sdef_from_file_existing()[source]
test_load_sdef_from_file_not_existing()[source]
test_load_sdef_from_file_raises()[source]
test_load_spritesheet()[source]
test_load_spritesheet_from_sdef()[source]
test_load_spritesheet_from_sdef_and_surface()[source]
test_load_spritesheet_is_loaded_with_different_extension()[source]
test_load_spritesheet_sdef_is_replaced_correctly()[source]
test_load_spritesheet_with_dir_path()[source]
class tests.test_spritesheetlib.TestSpritesheetLibSaveToDisk(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_image_is_deleted_if_exists_before_written_to_disk()[source]
test_image_is_written_to_disk()[source]
test_sdef_is_deleted_before_written_to_disk()[source]
test_sdef_is_written_to_disk()[source]
class tests.test_spritesheetlib.TestVersions(methodName='runTest')[source]

Bases: unittest.case.TestCase

This class test the version of this test module to be equal to the version of the module that is tested.

test_version_should_be_equal_to_mut_version()[source]

Tests if the module versions are equal.

tests.test_spritesheetlib.find_defining_class(obj, method_name)[source]

Finds the class where the method is defined. :param obj: any object :param method_name: the name of the method :return: returns the type of first class defining the method, otherwise None

tests.test_spritesheetlib.get_method_names(obj)[source]

Generator function that returns the public method names of the given object (public methods mean none that starts with ‘_’). :param obj: the object to get the method names from.

tests.test_spritesheetlib.remove_file(file_info, logger_instance=<logging.Logger object>)[source]

Tries to remove the given file. It will log an error if the file could not be removed. :param logger_instance: The logger instance to use. Defaults to the module logger. :param file_info: The filename to be removed.