示例#1
0
    def test_read_stanza(self):
        """Load stanza from string"""
        lines = b"""\
revision: [email protected]
timestamp: 1130653962
timezone: 36000
committer: Martin Pool <*****@*****.**>
""".splitlines(True)
        s = read_stanza(lines)
        self.assertTrue('revision' in s)
        self.assertEqual(s.get('revision'), '[email protected]')
        self.assertEqual(list(s.iter_pairs()),
                         [('revision', '[email protected]'),
                          ('timestamp', '1130653962'),
                          ('timezone', '36000'),
                          ('committer', "Martin Pool <*****@*****.**>")])
        self.assertEqual(len(s), 4)
示例#2
0
文件: test_rio.py 项目: tpow/breezy
 def test_read_empty(self):
     """Detect end of rio file"""
     s = read_stanza([])
     self.assertEqual(s, None)
     self.assertTrue(s is None)
示例#3
0
文件: test_rio.py 项目: tpow/breezy
 def test_backslash(self):
     s = Stanza(q='\\')
     t = s.to_string()
     self.assertEqual(t, b'q: \\\n')
     s2 = read_stanza(s.to_lines())
     self.assertEqual(s, s2)