summaryrefslogtreecommitdiff
path: root/_test/test_copy.py
diff options
context:
space:
mode:
Diffstat (limited to '_test/test_copy.py')
-rw-r--r--_test/test_copy.py56
1 files changed, 37 insertions, 19 deletions
diff --git a/_test/test_copy.py b/_test/test_copy.py
index 9a6deb0..a912259 100644
--- a/_test/test_copy.py
+++ b/_test/test_copy.py
@@ -6,16 +6,18 @@ Testing copy and deepcopy, instigated by Issue 84 (Peter Amstutz)
import copy
-import pytest # NOQA
+import pytest # NOQA
from roundtrip import dedent, round_trip_load, round_trip_dump
class TestDeepCopy:
def test_preserve_flow_style_simple(self):
- x = dedent("""\
+ x = dedent(
+ """\
{foo: bar, baz: quux}
- """)
+ """
+ )
data = round_trip_load(x)
data_copy = copy.deepcopy(data)
y = round_trip_dump(data_copy)
@@ -25,9 +27,11 @@ class TestDeepCopy:
assert data.fa.flow_style() == data_copy.fa.flow_style()
def test_deepcopy_flow_style_nested_dict(self):
- x = dedent("""\
+ x = dedent(
+ """\
a: {foo: bar, baz: quux}
- """)
+ """
+ )
data = round_trip_load(x)
assert data['a'].fa.flow_style() is True
data_copy = copy.deepcopy(data)
@@ -40,16 +44,20 @@ class TestDeepCopy:
print('x [{}]'.format(x))
print('y [{}]'.format(y))
- assert y == dedent("""\
+ assert y == dedent(
+ """\
a:
foo: bar
baz: quux
- """)
+ """
+ )
def test_deepcopy_flow_style_nested_list(self):
- x = dedent("""\
+ x = dedent(
+ """\
a: [1, 2, 3]
- """)
+ """
+ )
data = round_trip_load(x)
assert data['a'].fa.flow_style() is True
data_copy = copy.deepcopy(data)
@@ -62,19 +70,23 @@ class TestDeepCopy:
print('x [{}]'.format(x))
print('y [{}]'.format(y))
- assert y == dedent("""\
+ assert y == dedent(
+ """\
a:
- 1
- 2
- 3
- """)
+ """
+ )
class TestCopy:
def test_copy_flow_style_nested_dict(self):
- x = dedent("""\
+ x = dedent(
+ """\
a: {foo: bar, baz: quux}
- """)
+ """
+ )
data = round_trip_load(x)
assert data['a'].fa.flow_style() is True
data_copy = copy.copy(data)
@@ -87,16 +99,20 @@ class TestCopy:
z = round_trip_dump(data)
assert y == z
- assert y == dedent("""\
+ assert y == dedent(
+ """\
a:
foo: bar
baz: quux
- """)
+ """
+ )
def test_copy_flow_style_nested_list(self):
- x = dedent("""\
+ x = dedent(
+ """\
a: [1, 2, 3]
- """)
+ """
+ )
data = round_trip_load(x)
assert data['a'].fa.flow_style() is True
data_copy = copy.copy(data)
@@ -109,9 +125,11 @@ class TestCopy:
print('x [{}]'.format(x))
print('y [{}]'.format(y))
- assert y == dedent("""\
+ assert y == dedent(
+ """\
a:
- 1
- 2
- 3
- """)
+ """
+ )