summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pyclbr.py
diff options
context:
space:
mode:
authorAviral Srivastava <avi.srivastava254084@gmail.com>2021-02-01 17:38:44 (GMT)
committerGitHub <noreply@github.com>2021-02-01 17:38:44 (GMT)
commit000cde59847beaf5fa7b73633e1f3c898fe5bf90 (patch)
tree9b6036270daecbf44973288fed04215eeb8d24a5 /Lib/test/test_pyclbr.py
parentb5931f1d9f1f9f907e5cb6e193154672f78c1225 (diff)
downloadcpython-000cde59847beaf5fa7b73633e1f3c898fe5bf90.zip
cpython-000cde59847beaf5fa7b73633e1f3c898fe5bf90.tar.gz
cpython-000cde59847beaf5fa7b73633e1f3c898fe5bf90.tar.bz2
bpo-38307: Add end_lineno attribute to pyclbr Objects (GH-24348)
For back-compatibility, make the new constructor parameter for public classes Function and Class keyword-only with a default of None. Co-authored-by: Aviral Srivastava <aviralsrivastava@Avirals-MacBook-Air.local Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/test/test_pyclbr.py')
-rw-r--r--Lib/test/test_pyclbr.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 2c7afa9..82c1ebb 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -176,15 +176,15 @@ class PyclbrTest(TestCase):
actual = mb._create_tree(m, p, f, source, t, i)
# Create descriptors, linked together, and expected dict.
- f0 = mb.Function(m, 'f0', f, 1)
- f1 = mb._nest_function(f0, 'f1', 2)
- f2 = mb._nest_function(f1, 'f2', 3)
- c1 = mb._nest_class(f0, 'c1', 5)
- C0 = mb.Class(m, 'C0', None, f, 6)
- F1 = mb._nest_function(C0, 'F1', 8)
- C1 = mb._nest_class(C0, 'C1', 11)
- C2 = mb._nest_class(C1, 'C2', 12)
- F3 = mb._nest_function(C2, 'F3', 14)
+ f0 = mb.Function(m, 'f0', f, 1, end_lineno=5)
+ f1 = mb._nest_function(f0, 'f1', 2, 4)
+ f2 = mb._nest_function(f1, 'f2', 3, 3)
+ c1 = mb._nest_class(f0, 'c1', 5, 5)
+ C0 = mb.Class(m, 'C0', None, f, 6, end_lineno=14)
+ F1 = mb._nest_function(C0, 'F1', 8, 10)
+ C1 = mb._nest_class(C0, 'C1', 11, 14)
+ C2 = mb._nest_class(C1, 'C2', 12, 14)
+ F3 = mb._nest_function(C2, 'F3', 14, 14)
expected = {'f0':f0, 'C0':C0}
def compare(parent1, children1, parent2, children2):
@@ -203,8 +203,8 @@ class PyclbrTest(TestCase):
self.assertIs(ob.parent, parent2)
for key in children1.keys():
o1, o2 = children1[key], children2[key]
- t1 = type(o1), o1.name, o1.file, o1.module, o1.lineno
- t2 = type(o2), o2.name, o2.file, o2.module, o2.lineno
+ t1 = type(o1), o1.name, o1.file, o1.module, o1.lineno, o1.end_lineno
+ t2 = type(o2), o2.name, o2.file, o2.module, o2.lineno, o2.end_lineno
self.assertEqual(t1, t2)
if type(o1) is mb.Class:
self.assertEqual(o1.methods, o2.methods)