Exemplo n.º 1
0
 def test_toString(self):
     self.assertEquals(ListEntry(None, File, "thingo").toString(), "thingo")
     self.assertEquals(
         ListEntry(None, File, "thingo", Foo="foo").toString(), "thingo")
     self.assertEquals(
         ListEntry(None, Folder, "thingo").toString(), "thingo/")
     self.assertEquals(
         ListEntry(None, Folder, "thingo", Foo="foo").toString(), "thingo/")
Exemplo n.º 2
0
    def test_fieldNamesImplicit(self):
        # This test assumes File doesn't set list.fieldNames.
        assert not hasattr(File.list, "fieldNames")

        self.assertEquals(
            set(ListEntry(File(None, ()), File, "thingo").fieldNames),
            set(("Name", )))
Exemplo n.º 3
0
 def fields(fileClass):
     return tuple(
         ListEntry(fileClass(None, ()),
                   fileClass,
                   "thingo",
                   Flavor="Coconut",
                   Style="Hard").toFields())
Exemplo n.º 4
0
    def test_toFieldsImplicit(self):
        # This test assumes File doesn't set list.fieldNames.
        assert not hasattr(File.list, "fieldNames")

        # Name first, rest sorted by field name
        self.assertEquals(
            tuple(
                ListEntry(File(None, ()),
                          File,
                          "thingo",
                          Flavor="Coconut",
                          Style="Hard").toFields()),
            ("thingo", "Coconut", "Hard"))
Exemplo n.º 5
0
 def fieldNames(fileClass):
     return ListEntry(fileClass(None, ()),
                      fileClass,
                      "thingo",
                      Flavor="Coconut",
                      Style="Hard")