def test_when_rule_failed(self, capsys, settings): rule = Rule('test', Mock(side_effect=OSError('Denied')), requires_output=False) assert not corrector.is_rule_match( Command('ls'), rule, settings) assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'
def test_match(self, settings): rule = Rule('', lambda x, _: x.script == 'cd ..') assert corrector.is_rule_match(Command('cd ..'), rule, settings)
def test_no_match(self, settings): assert not corrector.is_rule_match( Command('ls'), Rule('', lambda *_: False), settings)
def test_when_rule_failed(self, capsys, settings): rule = Rule('test', Mock(side_effect=OSError('Denied')), requires_output=False) assert not corrector.is_rule_match(Command('ls'), rule, settings) assert capsys.readouterr()[1].split('\n')[0] == '[WARN] Rule test:'