Code Duplication    Length = 14-17 lines in 2 locations

tests/cli.py 2 locations

@@ 130-146 (lines=17) @@
127
    def test_30_w_get_option(self):
128
        d = dict(name="a", a=dict(b=dict(c=[1, 2], d="C")))
129
130
        infile = os.path.join(self.workdir, "a.json")
131
        output = os.path.join(self.workdir, "b.json")
132
133
        anyconfig.api.dump(d, infile)
134
        self.assertTrue(os.path.exists(infile))
135
136
        TT.main(["dummy", "-o", output, "--get", "a.b", infile])
137
        self.assertTrue(os.path.exists(output))
138
139
        x = anyconfig.api.load(output)
140
        self.assertEqual(x, d['a']['b'])
141
142
    def test_31_w_get_option_failure(self):
143
        (key, no_get_q) = ('a', "wrong_key_0.wrong_key_1")
144
        infile = os.path.join(self.workdir, "a.json")
145
        anyconfig.api.dump({key: "A"}, infile)
146
        self.assertTrue(os.path.exists(infile))
147
148
        self.run_and_check_exit_code(["--get", no_get_q, infile], 1)
149
@@ 107-120 (lines=14) @@
104
        except SystemExit:
105
            raised = True
106
107
        self.assertTrue(raised)
108
109
110
class Test_30_single_input(Test_20_Base):
111
112
    def test_10(self):
113
        a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"))
114
115
        infile = os.path.join(self.workdir, "a.json")
116
        output = os.path.join(self.workdir, "b.json")
117
118
        anyconfig.api.dump(a, infile)
119
        self.assertTrue(os.path.exists(infile))
120
121
        TT.main(["dummy", "-o", output, infile])
122
        self.assertTrue(os.path.exists(output))
123