Exemplo n.º 1
0
 def test__str__SampleNonEmptyDict(self):
     "__str__ - Dict with multiple headers each with 1 associated simple string value should result in leading Key: Value lines"
     x = MimeDict(Hello="World", Sheep="Dolly", Marvin="Android", Cat="Garfield")
     lines = str(x).splitlines(True)
     self.assertEqual(lines[4], "\r\n")
     header = lines[:4]
     header.sort()
     keys = x.keys()
     keys.sort()
     h = 0
     for k in keys:
         if k == "__BODY__":
             continue
         self.assertEqual(header[h], "%s: %s\r\n" % (k, x[k]))
         h += 1
Exemplo n.º 2
0
 def test__str__SampleNonEmptyDict(self):
     "__str__ - Dict with multiple headers each with 1 associated simple string value should result in leading Key: Value lines"
     x = MimeDict(Hello="World",
                  Sheep="Dolly",
                  Marvin="Android",
                  Cat="Garfield")
     lines = str(x).splitlines(True)
     self.assertEqual(lines[4], '\r\n')
     header = lines[:4]
     header.sort()
     keys = x.keys()
     keys.sort()
     h = 0
     for k in keys:
         if k == "__BODY__":
             continue
         self.assertEqual(header[h], "%s: %s\r\n" % (k, x[k]))
         h += 1