def test_separate_async_optionals_two_exist(): """confirms that when two creation group classes have async dependencies the class that has shared item as a dependency occurs first in a separate creation group """ order = has_create.creation_order( has_create.optional_dependency_graph(Four, Three, Two)) assert has_create.separate_async_optionals(order) == [ set([One]), set([Two]), set([Three]), set([Four]) ]
def test_separate_async_optionals_not_has_create(): """confirms that when a dependency isn't a HasCreate has_create.separate_aysnc_optionals doesn't unnecessarily move it from the initial creation group """ order = has_create.creation_order( has_create.optional_dependency_graph(Seven, Six)) assert has_create.separate_async_optionals(order) == [ set([One, IsntAHasCreate]), set([Two, Seven]), set([Six]) ]
def test_separate_async_optionals_none_exist(): """confirms that when creation group classes have no async optional dependencies the order is unchanged""" order = has_create.creation_order( has_create.optional_dependency_graph(Three, Two, One)) assert has_create.separate_async_optionals(order) == order