Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
coolamqp
Commits
d0a0dfae
Commit
d0a0dfae
authored
6 months ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fixes
#3
parent
3abdfb2b
No related branches found
No related tags found
No related merge requests found
Pipeline
#63413
failed with stages
Stage: unittest
Stage: build
in 2 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coolamqp/objects.py
+3
-2
3 additions, 2 deletions
coolamqp/objects.py
tests/test_objects.py
+2
-1
2 additions, 1 deletion
tests/test_objects.py
with
5 additions
and
3 deletions
coolamqp/objects.py
+
3
−
2
View file @
d0a0dfae
...
@@ -27,6 +27,8 @@ def toutf8(q):
...
@@ -27,6 +27,8 @@ def toutf8(q):
def
tobytes
(
q
):
def
tobytes
(
q
):
if
isinstance
(
q
,
memoryview
):
return
q
.
tobytes
()
return
q
.
encode
(
'
utf-8
'
)
if
isinstance
(
q
,
six
.
text_type
)
else
q
return
q
.
encode
(
'
utf-8
'
)
if
isinstance
(
q
,
six
.
text_type
)
else
q
...
@@ -287,8 +289,7 @@ class Queue(object):
...
@@ -287,8 +289,7 @@ class Queue(object):
if
name
is
None
:
if
name
is
None
:
self
.
name
=
None
self
.
name
=
None
else
:
else
:
name
=
uuid
.
uuid4
().
hex
if
not
name
else
name
self
.
name
=
tobytes
(
uuid
.
uuid4
().
hex
if
not
name
else
name
)
self
.
name
=
tobytes
(
name
)
self
.
durable
=
durable
self
.
durable
=
durable
self
.
exchange
=
exchange
self
.
exchange
=
exchange
...
...
This diff is collapsed.
Click to expand it.
tests/test_objects.py
+
2
−
1
View file @
d0a0dfae
# coding=UTF-8
# coding=UTF-8
from
__future__
import
print_function
,
absolute_import
,
division
from
__future__
import
print_function
,
absolute_import
,
division
import
sys
import
logging
import
logging
import
unittest
import
unittest
import
io
import
io
...
@@ -26,7 +27,7 @@ class TestObjects(unittest.TestCase):
...
@@ -26,7 +27,7 @@ class TestObjects(unittest.TestCase):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
Queue
(
'
test
'
,
auto_delete
=
True
,
exclusive
=
True
)
Queue
(
'
test
'
,
auto_delete
=
True
,
exclusive
=
True
)
Queue
(
auto_delete
=
True
,
exclusive
=
False
)
Queue
(
auto_delete
=
True
,
exclusive
=
False
)
self
.
assertEqual
(
len
(
w
),
2
)
self
.
assertEqual
(
len
(
w
),
2
if
sys
.
version
.
startswith
(
'
3
'
)
else
1
)
self
.
assertTrue
(
issubclass
(
w
[
0
].
category
,
UserWarning
))
self
.
assertTrue
(
issubclass
(
w
[
0
].
category
,
UserWarning
))
self
.
assertTrue
(
issubclass
(
w
[
1
].
category
,
DeprecationWarning
))
self
.
assertTrue
(
issubclass
(
w
[
1
].
category
,
DeprecationWarning
))
...
...
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