Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Romain Dorgueil
2018-10-29 07:23:58 +01:00
34 changed files with 231 additions and 208 deletions

View File

@ -131,20 +131,20 @@ def test_requires():
def test_constructor():
c1 = Container(foo='foo', bar='bar')
c1 = Container(foo="foo", bar="bar")
assert 2 == len(c1)
c2 = Container({'foo': 'foo', 'bar': 'bar'})
c2 = Container({"foo": "foo", "bar": "bar"})
assert 2 == len(c2)
assert c1['foo'] == c2['foo']
assert c1['bar'] == c2['bar']
assert c1["foo"] == c2["foo"]
assert c1["bar"] == c2["bar"]
with pytest.raises(ValueError):
Container({'bar': 'bar'}, foo='foo')
Container({"bar": "bar"}, foo="foo")
@pytest.mark.parametrize('services', [None, {}])
@pytest.mark.parametrize("services", [None, {}])
def test_create_container_empty_values(services):
c = create_container(services)
assert len(c) == 2

View File

@ -63,9 +63,9 @@ class CsvReaderTest(Csv, ReaderTest, TestCase):
def test_output_type(self, context):
context.write_sync(EMPTY)
context.stop()
self.check_output(context, prepend=[('id', 'name')])
self.check_output(context, prepend=[("id", "name")])
@incontext(output_fields=('x', 'y'), skip=1)
@incontext(output_fields=("x", "y"), skip=1)
def test_output_fields(self, context):
context.write_sync(EMPTY)
context.stop()
@ -100,10 +100,10 @@ class CsvWriterTest(Csv, WriterTest, TestCase):
@incontext()
def test_nofields_multiple_args(self, context):
# multiple args are iterated onto and flattened in output
context.write_sync((L1, L2), (L3, L4))
context.write_sync(L1, L2, L3, L4)
context.stop()
assert self.readlines() == ('a,hey', 'b,bee', 'c,see', 'd,dee')
assert self.readlines() == ("a,hey", "b,bee", "c,see", "d,dee")
@incontext()
def test_nofields_multiple_args_length_mismatch(self, context):
@ -111,18 +111,10 @@ class CsvWriterTest(Csv, WriterTest, TestCase):
with pytest.raises(TypeError):
context.write_sync((L1, L2), (L3,))
@incontext()
def test_nofields_single_arg(self, context):
# single args are just dumped, shapes can vary.
context.write_sync((L1,), (LL,), (L3,))
context.stop()
assert self.readlines() == ("a,hey", "i,have,more,values", "c,see")
@incontext()
def test_nofields_empty_args(self, context):
# empty calls are ignored
context.write_sync(EMPTY, EMPTY, EMPTY)
context.stop()
assert self.readlines() == ()
assert self.readlines() == ('', '', '')