Exemplo n.º 1
0
    def testEquality(self):
        """Test ConfigDictField.__eq__

        We create two configs, with the keys explicitly added in a different
        order and test their equality.
        """
        keys1 = ["A", "B", "C"]
        keys2 = ["X", "Y", "Z", "a", "b", "c", "d", "e"]

        c1 = Config3()
        c1.field1 = {k: pexConfig.Config() for k in keys1}
        for k in keys2:
            c1.field1[k] = pexConfig.Config()

        c2 = Config3()
        for k in keys2 + keys1:
            c2.field1[k] = pexConfig.Config()

        self.assertTrue(pexConfig.compareConfigs("test", c1, c2))
Exemplo n.º 2
0
    def testEquality(self):
        """Test DictField.__eq__

        We create two dicts, with the keys explicitly added in a different order
        and test their equality.
        """
        keys1 = ['A', 'B', 'C']
        keys2 = ['X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e']

        c1 = Config1()
        c1.d4 = {k: "" for k in keys1}
        for k in keys2:
            c1.d4[k] = ""

        c2 = Config1()
        for k in keys2 + keys1:
            c2.d4[k] = ""

        self.assertTrue(pexConfig.compareConfigs('test', c1, c2))
    def testEquality(self):
        """Test ConfigDictField.__eq__

        We create two configs, with the keys explicitly added in a different order
        and test their equality.
        """
        keys1 = ['A', 'B', 'C']
        keys2 = ['X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e']

        c1 = Config3()
        c1.field1 = {k: pexConfig.Config() for k in keys1}
        for k in keys2:
            c1.field1[k] = pexConfig.Config()

        c2 = Config3()
        for k in keys2 + keys1:
            c2.field1[k] = pexConfig.Config()

        self.assertTrue(pexConfig.compareConfigs('test', c1, c2))