def test_delete_algo(): investigator = Investigator() investigator.logger = module_logger investigator.register_algorithm('cubed', lambda x: x**3) investigator.register_algorithm('squared', lambda x: x**2) assert 2 == investigator.count_algorithms() investigator.delete_algorithm('squared') investigator.delete_algorithm('squared') assert 1 == investigator.count_algorithms() investigator.delete_algorithm('cubed') assert 0 == investigator.count_algorithms()
def test_clear(): investigator = Investigator() investigator.logger = module_logger investigator.register_algorithm('cubed', lambda x: x**3) investigator.register_algorithm('squared', lambda x: x**2) investigator.clear() assert 0 == investigator.count_algorithms()
def test_count_algos(): investigator = Investigator() investigator.logger = module_logger investigator.register_algorithm('cubed', lambda x: x**3) investigator.register_algorithm('cubed', lambda x: x**3) assert 1 == investigator.count_algorithms()