FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-rapidjson/tests/test_rawjson.py at master · python-rapidjson/python-rapidjson · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python-rapidjson
/
python-rapidjson
Public
Notifications
You must be signed in to change notification settings
Fork
53
Star
532
Code
Issues
18
Pull requests
4
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-rapidjson
/
tests
/
test_rawjson.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (26 loc) · 834 Bytes
Breadcrumbs
python-rapidjson
/
tests
/
test_rawjson.py
Copy path
File metadata and controls
36 lines (26 loc) · 834 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# -*- coding: utf-8 -*-
# :Project: python-rapidjson -- Tests on RawJSON
# :Author: Silvio Tomatis <silviot@gmail.com>
# :License: MIT License
# :Copyright: © 2018 Silvio Tomatis
# :Copyright: © 2018, 2020 Lele Gaifax
#
import
pytest
import
rapidjson
as
rj
def
test_instantiation_positional
():
value
=
'a string'
raw
=
rj
.
RawJSON
(
value
)
assert
raw
.
value
==
value
def
test_instantiation_named
():
value
=
'a string'
raw
=
rj
.
RawJSON
(
value
=
value
)
assert
raw
.
value
==
value
def
test_only_bytes_allowed
():
with
pytest
.
raises
(
TypeError
):
rj
.
RawJSON
(
b'A bytes string'
)
with
pytest
.
raises
(
TypeError
):
rj
.
RawJSON
({})
with
pytest
.
raises
(
TypeError
):
rj
.
RawJSON
(
None
)
def
test_mix_preserialized
():
assert
rj
.
dumps
({
'a'
:
rj
.
RawJSON
(
'{1 : 2}'
)})
==
'{"a":{1 : 2}}'
Back
|
FazBrowse Home
|
New Git URL