Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
be13b8d9
Commit
be13b8d9
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
tests for Proxy
parent
e56ef28f
No related branches found
Branches containing commit
Tags
v2.1.10
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
satella/coding/structures/proxy.py
+2
-3
2 additions, 3 deletions
satella/coding/structures/proxy.py
tests/test_coding/test_proxy.py
+3
-0
3 additions, 0 deletions
tests/test_coding/test_proxy.py
with
5 additions
and
3 deletions
satella/coding/structures/proxy.py
+
2
−
3
View file @
be13b8d9
...
...
@@ -31,8 +31,7 @@ class Proxy(tp.Generic[T]):
Note that in-place operations will return the Proxy itself, whereas simple addition will shed
this proxy, returning object wrapped plus something.
Note that proxies are considered to be the type of the object that they wrap,
as well as considered to be of type Proxy.
Only __isinstance__ check is not overridden, due to Python limitations.
Please access this object in your descendant classes via
...
...
@@ -41,7 +40,7 @@ class Proxy(tp.Generic[T]):
Please note that this class does not overload the descriptor protocol,
not the pickle interface!
Note that this overloads
both
__repr__ and __
st
r__, which may prove confusing.
Note that this overloads __repr__
, __str__
and __
di
r__, which may prove confusing.
Handle this in your descendant classes.
:param object_to_wrap: object to wrap
...
...
This diff is collapsed.
Click to expand it.
tests/test_coding/test_proxy.py
+
3
−
0
View file @
be13b8d9
...
...
@@ -6,7 +6,10 @@ from satella.coding.structures import Proxy
class
TestProxy
(
unittest
.
TestCase
):
def
test_proxy
(
self
):
a
=
Proxy
(
5.25
,
True
)
self
.
assertIsInstance
(
a
+
2
,
Proxy
)
a
=
Proxy
(
5.25
)
self
.
assertNotIsInstance
(
a
+
2
,
Proxy
)
self
.
assertEqual
(
int
(
a
),
5
)
self
.
assertEqual
(
float
(
a
),
5.25
)
self
.
assertEqual
(
a
-
0.25
,
5.0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment