Skip to content

Commit 022de89

Browse files
committed
Adds failing test
1 parent 1a53cbd commit 022de89

File tree

5 files changed

+86
-39
lines changed

5 files changed

+86
-39
lines changed

Pipfile.lock

Lines changed: 55 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

labelbox/lbx.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"Module for interacting with the LBX file format."
2+
3+
def encode(image):
4+
"""Converts a `PIL.Image` to a `io.BytesIO` with LBX encoded data.
5+
6+
Args:
7+
image (`PIL.Image`): The image to encode.
8+
9+
Returns:
10+
A `io.BytesIO` containing the LBX encoded image.
11+
"""
12+
pass
13+
14+
def decode(lbx):
15+
"""Decodes a `io.BytesIO` with LBX encoded data into a `PIL.Image`.
16+
17+
Args:
18+
lbxA (`io.BytesIO`): A byte buffer containing the LBX encoded image data.
19+
20+
Returns:
21+
A `PIL.Image` of the decoded data.
22+
"""
23+
pass
File renamed without changes.

tests/test_lbx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from PIL import Image
2+
import labelbox.lbx as lbx
3+
4+
def test_identity(datadir):
5+
im = Image.open(datadir.join('PNG_transparency_demonstration_2.png'))
6+
print(im)
7+
assert np.array(lbx.decode(lbx.encode(im))) == np.array(im)
8+
178 KB
Loading

0 commit comments

Comments
 (0)