def test_field_init_one_value(self): field = Field("Files", "foobar.foo") self.assertEqual(field.name, "Files") self.assertEqual(len(field), 1) self.assertIsNone(field.line_number) self.assertEqual(list(field)[0], "foobar.foo") field.add_content("barfoo.bar") self.assertEqual(len(field), 2) self.assertEqual(list(field)[1], "barfoo.bar")
def test_field_init_without_value(self): field = Field("name") self.assertEqual(field.name, "name") self.assertEqual(len(field), 0) self.assertIsNone(field.line_number) field.add_content("value content") self.assertEqual(len(field), 1) self.assertEqual(list(field)[0], "value content") field.add_content("other value content") self.assertEqual(len(field), 2) self.assertEqual(list(field)[1], "other value content")