mirror of
https://github.com/wassname/sloth.git
synced 2026-06-27 18:25:49 +08:00
pep8 changes
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from sloth.annotations.container import *
|
||||
|
||||
|
||||
class MockupContainer:
|
||||
pass
|
||||
|
||||
|
||||
def someFileAnnotations(i):
|
||||
annotations = []
|
||||
annotations.append({'type': 'rect',
|
||||
@@ -21,6 +23,7 @@ def someFileAnnotations(i):
|
||||
'y': 30 * k})
|
||||
return annotations
|
||||
|
||||
|
||||
def someAnnotations():
|
||||
annotations = []
|
||||
for i in range(5):
|
||||
@@ -32,6 +35,7 @@ def someAnnotations():
|
||||
annotations.append(file)
|
||||
return annotations
|
||||
|
||||
|
||||
def common_container_test(filename, container):
|
||||
original_anns = someAnnotations()
|
||||
|
||||
@@ -50,22 +54,26 @@ def common_container_test(filename, container):
|
||||
assert container.filename() == filename
|
||||
assert len(container.annotations()) == len(original_anns)
|
||||
|
||||
|
||||
def test_import_callable():
|
||||
containers = (('*', 'container_test.MockupContainer'),)
|
||||
factory = AnnotationContainerFactory(containers)
|
||||
item = factory.create('test')
|
||||
assert isinstance(item, MockupContainer)
|
||||
|
||||
|
||||
def test_PickleContainer(tmpdir):
|
||||
filename = os.path.join(str(tmpdir), "test_PickleContainer.pickle")
|
||||
container = PickleContainer()
|
||||
common_container_test(filename, container)
|
||||
|
||||
|
||||
def test_JsonContainer(tmpdir):
|
||||
filename = os.path.join(str(tmpdir), "test_JsonContainer.json")
|
||||
container = JsonContainer()
|
||||
common_container_test(filename, container)
|
||||
|
||||
|
||||
def test_YamlContainer(tmpdir):
|
||||
filename = os.path.join(str(tmpdir), "test_YamlContainer.yaml")
|
||||
container = YamlContainer()
|
||||
|
||||
Reference in New Issue
Block a user