From fcecac20ec5fb8fba5f58df8d2729414c5b22d2a Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 20 Dec 2019 20:03:12 +0100 Subject: [PATCH] Add tests to fix all the deprecations --- test/test_deprecation.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/test_deprecation.py diff --git a/test/test_deprecation.py b/test/test_deprecation.py new file mode 100644 index 00000000..ed3603e6 --- /dev/null +++ b/test/test_deprecation.py @@ -0,0 +1,27 @@ +def test_goto_definitions(Script): + int_, = Script('x = 1\nx, y\ny', line=2, column=0).goto_definitions() + assert int_.name == 'int' + + +def test_completions(Script): + c1, c2 = Script('foobar = 1\nfoobaz= 2\nfoobaz, ffff\nfool = 3', line=3, column=3).completions() + assert c1.name == 'foobar' + assert c2.name == 'foobaz' + + +def test_goto_assignments(Script): + int_, = Script('x = 1\nx, y\ny', line=2, column=0).goto_assignments() + assert int_.get_line_code() == 'x = 1\n' + + +def test_usages(Script): + d1, d2 = Script('x = 1\nx, y\ny', line=2, column=0).usages() + assert d1.name == 'x' + assert d1.line == 1 + assert d2.name == 'x' + assert d2.line == 2 + + +def test_call_signatures(Script): + d1, = Script('abs(float(\nstr(', line=1, column=4).call_signatures() + assert d1.name == 'abs'