forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBPythonObjectTest.class.st
More file actions
46 lines (41 loc) · 1.31 KB
/
PBPythonObjectTest.class.st
File metadata and controls
46 lines (41 loc) · 1.31 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Class {
#name : #PBPythonObjectTest,
#superclass : #PBApplicationTest,
#category : #'PythonBridge-Tests'
}
{ #category : #tests }
PBPythonObjectTest >> setUp [
super setUp.
self cf << (#PythonBridge asP3GI => #object_registry) import
]
{ #category : #tests }
PBPythonObjectTest >> stubPythonObjectExpression [
^ #PythonBridge asP3GI => #object_registry => #Registry callWith: #()
]
{ #category : #tests }
PBPythonObjectTest >> testProxyIdentity [
| obj |
self cf << self stubPythonObjectExpression.
obj := self cfSend waitForValue.
self assert: obj class equals: PBProxyObject.
self assertInstanceClass: obj name: 'Registry'.
self cf << (self resolveId: obj id).
self assert: self cfSend waitForValue equals: obj
]
{ #category : #tests }
PBPythonObjectTest >> testSimpleObjectIdentity [
| obj |
obj := PBObject new basicCreateObjectExpr: self stubPythonObjectExpression.
self cf << obj.
self assert: self cfSend waitForValue equals: obj.
self assertExpression: (self resolveId: obj id) equals: obj
]
{ #category : #tests }
PBPythonObjectTest >> testSimpleProxy [
| obj |
self cf << self stubPythonObjectExpression.
obj := self cfSend waitForValue.
self assert: obj class equals: PBProxyObject.
self assertInstanceClass: obj name: 'Registry'.
self assertExpression: (obj => #hasId callWith: #(0)) equals: false
]