test\unit\test_operators.py
-- -- --- --- --- --- --- --- ------- ------- ------- | import pytest
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- | import wily.operators
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 001 002 001 002 003 003 0004.75 0002.38 0000.50 | def test_resolve_operator():
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | op = wily.operators.resolve_operator("cyclomatic")
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | assert op == wily.operators.OPERATOR_CYCLOMATIC
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | def test_resolve_bad_operator():
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | with pytest.raises(ValueError):
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | wily.operators.resolve_operator("banana")
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 001 004 002 004 005 006 0013.93 0006.97 0000.50 | def test_resolve_operators():
-- -- 001 004 002 004 005 006 0013.93 0006.97 0000.50 | ops = wily.operators.resolve_operators(("cyclomatic", "raw"))
-- -- 001 004 002 004 005 006 0013.93 0006.97 0000.50 | assert ops[0] == wily.operators.OPERATOR_CYCLOMATIC
-- -- 001 004 002 004 005 006 0013.93 0006.97 0000.50 | assert ops[1] == wily.operators.OPERATOR_RAW
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 001 002 001 002 003 003 0004.75 0002.38 0000.50 | def test_resolve_metric():
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | metric = wily.operators.resolve_metric("raw.loc")
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | assert metric.name == "loc"
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | def test_resolve_invalid_metric():
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | with pytest.raises(ValueError):
-- 01 000 000 000 000 000 000 0000.00 0000.00 0000.00 | wily.operators.resolve_metric("raw.spanner")
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 001 002 001 002 003 003 0004.75 0002.38 0000.50 | def test_resolve_short_metric():
-- -- 001 002 001 002 003 003 0004.75 0002.38 0000.50 | metric = wily.operators.resolve_metric("loc")
-- -- --- --- --- --- --- --- ------- ------- ------- | assert metric.name == "loc"