~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbasicio.py

  • Committer: Martin Pool
  • Date: 2005-10-30 07:57:41 UTC
  • mto: (1185.33.49 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: mbp@sourcefrog.net-20051030075741-9617a3608c929266
Add Stanza.get_all and test repeated fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
                 ('committer', "Martin Pool <mbp@test.sourcefrog.net>")])
118
118
        self.assertEquals(len(s), 4)
119
119
 
 
120
    def test_repeated_field(self):
 
121
        """Repeated field in basic_io"""
 
122
        s = Stanza()
 
123
        for k, v in [('a', 10), ('b', 20), ('a', 100), ('b', 200), ('a', 1000), ('b', 2000)]:
 
124
            s.add(k, v)
 
125
        t = s.to_string()
 
126
        s2 = Stanza.from_string(t)
 
127
        self.assertEquals(s, s2)
 
128
        self.assertEquals(s.get_all('a'), [10, 100, 1000])
 
129
        self.assertEquals(s.get_all('b'), [20, 200, 2000])
 
130
 
120
131
    def test_longint(self):
121
132
        """basic_io packing long integers"""
122
133
        s = Stanza(x=-12345678901234567890,