Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
b4db8880
Commit
b4db8880
authored
Oct 08, 2015
by
Robert
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #286 from tguo-aa/fix-278
Add self.assertNotNested() in CreateString
parents
e1e1bced
d9db4825
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
builder.py
python/flatbuffers/builder.py
+2
-0
py_test.py
tests/py_test.py
+7
-0
No files found.
python/flatbuffers/builder.py
View file @
b4db8880
...
@@ -350,6 +350,8 @@ class Builder(object):
...
@@ -350,6 +350,8 @@ class Builder(object):
def
CreateString
(
self
,
s
):
def
CreateString
(
self
,
s
):
"""CreateString writes a null-terminated byte string as a vector."""
"""CreateString writes a null-terminated byte string as a vector."""
self
.
assertNotNested
()
if
isinstance
(
s
,
compat
.
string_types
):
if
isinstance
(
s
,
compat
.
string_types
):
x
=
s
.
encode
()
x
=
s
.
encode
()
elif
isinstance
(
s
,
compat
.
binary_type
):
elif
isinstance
(
s
,
compat
.
binary_type
):
...
...
tests/py_test.py
View file @
b4db8880
...
@@ -1130,6 +1130,13 @@ class TestExceptions(unittest.TestCase):
...
@@ -1130,6 +1130,13 @@ class TestExceptions(unittest.TestCase):
assertRaises
(
self
,
lambda
:
b
.
PrependUOffsetTRelative
(
1
),
assertRaises
(
self
,
lambda
:
b
.
PrependUOffsetTRelative
(
1
),
flatbuffers
.
builder
.
OffsetArithmeticError
)
flatbuffers
.
builder
.
OffsetArithmeticError
)
def
test_create_string_is_nested_error
(
self
):
b
=
flatbuffers
.
Builder
(
0
)
b
.
StartObject
(
0
)
s
=
'test1'
assertRaises
(
self
,
lambda
:
b
.
CreateString
(
s
),
flatbuffers
.
builder
.
ObjectIsNestedError
)
def
CheckAgainstGoldDataGo
():
def
CheckAgainstGoldDataGo
():
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment