Exemple #1
0
 def regen(self, wt, **kwargs):
     sio = StringIO()
     builder = RioVersionInfoBuilder(wt.branch, working_tree=wt, **kwargs)
     builder.generate(sio)
     sio.seek(0)
     stanzas = list(read_stanzas(sio))
     self.assertEqual(1, len(stanzas))
     return stanzas[0]
Exemple #2
0
 def regen(self, wt, **kwargs):
     sio = StringIO()
     builder = RioVersionInfoBuilder(wt.branch, working_tree=wt, **kwargs)
     builder.generate(sio)
     sio.seek(0)
     stanzas = list(read_stanzas(sio))
     self.assertEqual(1, len(stanzas))
     return stanzas[0]
Exemple #3
0
    def test_read_iter(self):
        """Read several stanzas from file"""
        tmpf = TemporaryFile()
        tmpf.write("""\
version_header: 1

name: foo
val: 123

name: bar
val: 129319
""")
        tmpf.seek(0)
        reader = read_stanzas(tmpf)
        read_iter = iter(reader)
        stuff = list(reader)
        self.assertEqual(stuff,
                [ Stanza(version_header='1'),
                  Stanza(name="foo", val='123'),
                  Stanza(name="bar", val='129319'), ])
Exemple #4
0
    def test_read_iter(self):
        """Read several stanzas from file"""
        tmpf = TemporaryFile()
        tmpf.write("""\
version_header: 1

name: foo
val: 123

name: bar
val: 129319
""")
        tmpf.seek(0)
        reader = read_stanzas(tmpf)
        read_iter = iter(reader)
        stuff = list(reader)
        self.assertEqual(stuff, [
            Stanza(version_header='1'),
            Stanza(name="foo", val='123'),
            Stanza(name="bar", val='129319'),
        ])
Exemple #5
0
 def get_one_stanza(self, stanza, key):
     new_stanzas = list(read_stanzas(StringIO(stanza[key].encode('utf8'))))
     self.assertEqual(1, len(new_stanzas))
     return new_stanzas[0]
Exemple #6
0
 def get_one_stanza(stanza, key):
     new_stanzas = list(read_stanzas(
                         StringIO(stanza[key].encode('utf8'))))
     self.assertEqual(1, len(new_stanzas))
     return new_stanzas[0]