示例#1
0
    def test_exclusive(self):
        var = Variable("x")
        colors = [Mock(), Mock()]
        palette = Mock()
        var.colors = colors
        var.palette = palette
        self.assertIsNone(var.colors)
        self.assertTrue("palette" in var.attributes)
        self.assertFalse("colors" in var.attributes)

        var.colors = colors
        self.assertIsNone(var.palette)
        self.assertTrue("colors" in var.attributes)
        self.assertFalse("palette" in var.attributes)
示例#2
0
    def test_exclusive(self):
        var = Variable("x")
        colors = [Mock(), Mock()]
        palette = Mock()
        var.colors = colors
        # set_color for variable does not set this attribute; derived methods do
        var.attributes["colors"] = colors
        var.palette = palette
        self.assertIsNone(var.colors)
        self.assertTrue("palette" in var.attributes)
        self.assertFalse("colors" in var.attributes)

        var.colors = colors
        # set_color for variable does not set this attribute; derived methods do
        var.attributes["colors"] = colors
        self.assertIsNone(var.palette)
        self.assertTrue("colors" in var.attributes)
        self.assertFalse("palette" in var.attributes)
示例#3
0
 def test_colors(self):
     var = Variable("x")
     colors = [Mock(), Mock()]
     var.colors = colors
     self.assertIs(var.colors, colors)