Selaa lähdekoodia

add some test

BLUELOVETH 2 vuotta sitten
vanhempi
commit
f2d87467df
2 muutettua tiedostoa jossa 22 lisäystä ja 1 poistoa
  1. 4 0
      .gitignore
  2. 18 1
      tests/44_decorator.py

+ 4 - 0
.gitignore

@@ -23,3 +23,7 @@ profile.sh
 test
 tmp.rar
 src/httplib.h
+pocketpy.exe
+main.obj
+pocketpy.exp
+pocketpy.lib

+ 18 - 1
tests/44_decorator.py

@@ -19,4 +19,21 @@ class A:
         return self._x
     
 a = A(1)
-assert a.x == 1
+assert a.x == 1
+
+class B:
+    def __init__(self):
+        self._x = 1
+
+    def _x_setter(self, v):
+        self._x = v
+
+B.x = property(
+        lambda self: self._x,
+        B._x_setter
+    )
+
+b = B()
+assert b.x == 1
+b.x = 2
+assert b.x == 2