mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Moved former skeletons test for namedtuple() to regular tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from collections import namedtuple
|
||||
|
||||
Point = namedtuple('Point', 'x y')
|
||||
p = Point(1, 2)
|
||||
|
||||
# Fields and unpacking
|
||||
x, y = p
|
||||
x, y, z = p
|
||||
print(p.x, p.y, p.<warning descr="Unresolved attribute reference 'z' for class 'Point'">z</warning>)
|
||||
print(Point.x, Point.y, Point.<warning descr="Unresolved attribute reference 'z' for class 'Point'">z</warning>)
|
||||
|
||||
# Tuple attributes
|
||||
print(p.count(1), p.__class__, p.__add__((1, 2)))
|
||||
|
||||
# Named tuple attribute
|
||||
print(Point.__slots__, Point._fields)
|
||||
print(p.__module__, p.__slots__)
|
||||
print(p._asdict(), p._fields, p._replace(x=42))
|
||||
Reference in New Issue
Block a user