当前位置: 首页>>代码示例>>Python>>正文


Python base.Aggregate类代码示例

本文整理汇总了Python中ofxtools.models.base.Aggregate的典型用法代码示例。如果您正苦于以下问题:Python Aggregate类的具体用法?Python Aggregate怎么用?Python Aggregate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Aggregate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testFromEtreeWrongOrder

    def testFromEtreeWrongOrder(self):
        root = ET.Element("TESTLIST")
        agg = ET.SubElement(root, "TESTAGGREGATE2")
        ET.SubElement(agg, "METADATA").text = "dumbo"
        ET.SubElement(root, "METADATA").text = "foo"

        with self.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:8,代码来源:test_models_base.py

示例2: testMultipleCcacctinfo

    def testMultipleCcacctinfo(cls):
        root = Element("ACCTINFO")
        ccacctinfo = bk_stmt.CcacctinfoTestCase.etree
        root.append(ccacctinfo)
        root.append(ccacctinfo)

        with cls.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:8,代码来源:test_models_signup.py

示例3: testMultipleInvacctinfo

    def testMultipleInvacctinfo(cls):
        root = Element("ACCTINFO")
        invacctinfo = invest.InvacctinfoTestCase.etree
        root.append(invacctinfo)
        root.append(invacctinfo)

        with cls.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:8,代码来源:test_models_signup.py

示例4: testPropertyAliases

 def testPropertyAliases(self):
     instance = Aggregate.from_etree(self.etree)
     stmttrn = Aggregate.from_etree(bk_stmt.StmttrnTestCase.etree)
     self.assertEqual(instance.trntype, stmttrn.trntype)
     self.assertEqual(instance.dtposted, stmttrn.dtposted)
     self.assertEqual(instance.trnamt, stmttrn.trnamt)
     self.assertEqual(instance.fitid, stmttrn.fitid)
     self.assertEqual(instance.memo, stmttrn.memo)
开发者ID:csingley,项目名称:ofxtools,代码行数:8,代码来源:test_models_invest_transactions.py

示例5: testListItems

    def testListItems(self):
        # PROFMSGSRSV1 may only contain PROFTRNRS
        listitems = PROFMSGSRSV1.listitems
        self.assertEqual(len(listitems), 1)
        root = self.etree
        root.append(profile.ProftrnrqTestCase.etree)

        with self.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:9,代码来源:test_models_msgsets.py

示例6: testListItems

    def testListItems(cls):
        # INVPOSLIST may only contain
        # ['POSDEBT', 'POSMF', 'POSOPT', 'POSOTHER', 'POSSTOCK', ]
        listitems = INVPOSLIST.listitems
        cls.assertEqual(len(listitems), 5)
        root = cls.etree
        root.append(bk_stmt.StmttrnTestCase.etree)

        with cls.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:10,代码来源:test_models_invest.py

示例7: testFromEtreeMissingRequired

    def testFromEtreeMissingRequired(self):
        root = ET.Element("TESTAGGREGATE")
        ET.SubElement(root, "REQ00").text = "Y"
        ET.SubElement(root, "REQ11").text = "N"
        sub = ET.Element("TESTSUBAGGREGATE")
        ET.SubElement(sub, "DATA").text = "data"
        root.append(sub)
        ET.SubElement(root, "DONTUSE").text = "dontuse"

        with self.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:11,代码来源:test_models_base.py

示例8: testOptional

 def testOptional(self):
     if self.optionalElements:
         for tag in self.optionalElements:
             etree = deepcopy(self.etree)
             child = etree.find(tag)
             try:
                 etree.remove(child)
             except TypeError:
                 msg = "Can't find {} (from optionalElements) under {}"
                 raise ValueError(msg.format(tag, etree.tag))
             Aggregate.from_etree(etree)
开发者ID:csingley,项目名称:ofxtools,代码行数:11,代码来源:base.py

示例9: testRequired

 def testRequired(self):
     if self.requiredElements:
         for tag in self.requiredElements:
             etree = deepcopy(self.etree)
             child = etree.find(tag)
             try:
                 etree.remove(child)
             except TypeError:
                 msg = "Can't find {} (from requiredElements) under {}"
                 raise ValueError(msg.format(tag, etree.tag))
             with self.assertRaises(ValueError):
                 Aggregate.from_etree(etree)
开发者ID:csingley,项目名称:ofxtools,代码行数:12,代码来源:base.py

示例10: testListItems

    def testListItems(self):
        # INVOOLIST may only contain
        # ['OOBUYDEBT', 'OOBUYMF', 'OOBUYOPT', 'OOBUYOTHER',
        # 'OOBUYSTOCK', 'OOSELLDEBT', 'OOSELLMF', 'OOSELLOPT',
        # 'OOSELLOTHER', 'OOSELLSTOCK', 'SWITCHMF', ]
        listitems = INVOOLIST.listitems
        self.assertEqual(len(listitems), 11)
        root = self.etree
        root.append(bk_stmt.StmttrnTestCase.etree)

        with self.assertRaises(ValueError):
            Aggregate.from_etree(root)
开发者ID:csingley,项目名称:ofxtools,代码行数:12,代码来源:test_models_invest_oo.py

示例11: oneOfTest

    def oneOfTest(self, tag, texts):
        # Make sure OneOf validator allows all legal values and disallows
        # illegal values
        for text in texts:
            etree = deepcopy(self.etree)
            target = etree.find(".//%s" % tag)
            target.text = text
            Aggregate.from_etree(etree)

        etree = deepcopy(self.etree)
        target = etree.find(".//%s" % tag)
        target.text = "garbage"
        with self.assertRaises(ValueError):
            Aggregate.from_etree(etree)
开发者ID:csingley,项目名称:ofxtools,代码行数:14,代码来源:base.py

示例12: testConvertSecnameTooLong

 def testConvertSecnameTooLong(self):
     """ Don't enforce length restriction on SECNAME; raise Warning """
     # Issue #12
     root = self.etree
     root[1].text = """
     There is a theory going around that the U.S.A. was and still is a
     gigantic Masonic plot under the ultimate control of the group known as
     the Illuminati. It is difficult to look for long at the strange single
     eye crowning the pyramid which is found on every dollar bill and not
     begin to believe the story, a little. Too many anarchists in
     19th-century Europe — Bakunin, Proudhon, Salverio Friscia — were Masons
     for it to be pure chance. Lovers of global conspiracy, not all of them
     Catholic, can count on the Masons for a few good shivers and voids when
     all else fails.
     """
     with self.assertWarns(Warning):
         instance = Aggregate.from_etree(root)
     self.assertEqual(
         instance.secname,
         """
     There is a theory going around that the U.S.A. was and still is a
     gigantic Masonic plot under the ultimate control of the group known as
     the Illuminati. It is difficult to look for long at the strange single
     eye crowning the pyramid which is found on every dollar bill and not
     begin to believe the story, a little. Too many anarchists in
     19th-century Europe — Bakunin, Proudhon, Salverio Friscia — were Masons
     for it to be pure chance. Lovers of global conspiracy, not all of them
     Catholic, can count on the Masons for a few good shivers and voids when
     all else fails.
     """)
开发者ID:csingley,项目名称:ofxtools,代码行数:30,代码来源:test_models_securities.py

示例13: testUnsupported

 def testUnsupported(self):
     instance = Aggregate.from_etree(self.root)
     unsupported = list(instance.unsupported)
     self.assertEqual(unsupported, self.unsupported)
     for unsupp in unsupported:
         setattr(instance, unsupp, "FOOBAR")
         self.assertIsNone(getattr(instance, unsupp))
开发者ID:csingley,项目名称:ofxtools,代码行数:7,代码来源:test_models_ofx.py

示例14: convert

 def convert(self) -> Aggregate:
     """
     Transform tree of `ElementTree.Element` instances into hierarchy of
     `ofxtools.models.base.Aggregate` & `ofxtools.Types.Element` instances.
     """
     if not isinstance(self._root, ET.Element):
         raise ValueError("Must first call parse() to have data to convert")
     instance = Aggregate.from_etree(self._root)
     return instance
开发者ID:csingley,项目名称:ofxtools,代码行数:9,代码来源:Parser.py

示例15: testFromEtree

    def testFromEtree(self):
        instance = Aggregate.from_etree(self.root)
        self.assertIsInstance(instance, TESTLIST)
        self.assertEqual(instance.metadata, "foo")
        self.assertEqual(len(instance), 3)
        agg0, agg1, agg2 = instance[:]

        self.assertIsInstance(agg0, TESTAGGREGATE)
        self.assertIsInstance(agg1, TESTAGGREGATE)
        self.assertIsInstance(agg2, TESTAGGREGATE2)
开发者ID:csingley,项目名称:ofxtools,代码行数:10,代码来源:test_models_base.py


注:本文中的ofxtools.models.base.Aggregate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。