File: chain.py

package info (click to toggle)
python-sphinx-codeautolink 0.17.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 936 kB
  • sloc: python: 2,818; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from ._util import refs_equal


class TestChain:
    @refs_equal
    def test_attr_call_doesnt_contain_call(self):
        s = "import a\na.attr()"
        refs = [("a", "a"), ("a.attr", "a.attr")]
        return s, refs

    @refs_equal
    def test_attr_call_attr_split_in_two(self):
        s = "import a\na.attr().b"
        refs = [("a", "a"), ("a.attr", "a.attr"), ("a.attr.().b", "b")]
        return s, refs

    @refs_equal
    def test_attr_call_attr_call_attr_split_in_three(self):
        s = "import a\na.attr().b().c"
        refs = [
            ("a", "a"),
            ("a.attr", "a.attr"),
            ("a.attr.().b", "b"),
            ("a.attr.().b.().c", "c"),
        ]
        return s, refs