Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
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()