# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import concurrent

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_009_test_input.vhd"))

# 00000
lExpected_align_left_no = []
lExpected_align_left_no.append("")
utils.read_file(os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no.vhd"), lExpected_align_left_no)

# 00001
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes = []
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes,
)

# 00010
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes = []
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes,
)

# 00011
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes,
)

# 00100
lExpected_align_left_no_align_paren_no_align_when_yes = []
lExpected_align_left_no_align_paren_no_align_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_yes,
)

# 00101
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes = []
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes,
)

# 00110
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes = []
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes,
)

# 00111
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes,
)

# 01000
lExpected_align_left_no_align_paren_yes = []
lExpected_align_left_no_align_paren_yes.append("")
utils.read_file(os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes.vhd"), lExpected_align_left_no_align_paren_yes)

# 01001
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes = []
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes,
)

# 01010
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes = []
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes,
)

# 01011
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes,
)

# 01100
lExpected_align_left_no_align_paren_yes_align_when_yes = []
lExpected_align_left_no_align_paren_yes_align_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_yes,
)

# 01101
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes = []
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes,
)

# 01110
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes = []
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes,
)

# 01111
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes,
)

# 10000
lExpected_align_left_yes = []
lExpected_align_left_yes.append("")
utils.read_file(os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes.vhd"), lExpected_align_left_yes)

# 10001
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes = []
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes,
)

# 10010
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes = []
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes,
)

# 10011
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes,
)

# 10100
lExpected_align_left_yes_align_paren_no_align_when_yes = []
lExpected_align_left_yes_align_paren_no_align_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_yes,
)

# 10101
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes = []
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes,
)

# 10110
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes = []
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes,
)

# 10111
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes,
)

# 11000
lExpected_align_left_yes_align_paren_yes = []
lExpected_align_left_yes_align_paren_yes.append("")
utils.read_file(os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes.vhd"), lExpected_align_left_yes_align_paren_yes)

# 11001
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes,
)

# 11010
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes,
)

# 11011
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes,
)

# 11100
lExpected_align_left_yes_align_paren_yes_align_when_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_yes,
)

# 11101
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes,
)

# 11110
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes,
)

# 11111
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes = []
lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes.append("")
utils.read_file(
    os.path.join(sTestDir, "rule_009_test_input.fixed_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes.vhd"),
    lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes,
)


class test_concurrent_rule(unittest.TestCase):
    def setUp(self):
        self.oFile = vhdlFile.vhdlFile(lFile)
        self.assertIsNone(eError)

    def test_rule_009(self):
        oRule = concurrent.rule_009()
        self.assertTrue(oRule)
        self.assertEqual(oRule.name, "concurrent")
        self.assertEqual(oRule.identifier, "009")

    def test_fix_rule_009_align_left_no(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(oRule.groups, ["alignment"])
        self.assertEqual(lExpected_align_left_no, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = False
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_no_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.wrap_at_when = False
        oRule.align_when_keywords = False
        oRule.align_else_keywords = False
        oRule.align_paren = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_no_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = False
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_no_align_when_yes_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = False
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_no_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = False
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_no_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = False

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])

    def test_fix_rule_009_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes(self):
        oRule = concurrent.rule_009()
        oRule.align_left = True
        oRule.align_paren = True
        oRule.align_when_keywords = True
        oRule.wrap_at_when = True
        oRule.align_else_keywords = True

        oRule.fix(self.oFile)

        lActual = self.oFile.get_lines()

        self.assertEqual(lExpected_align_left_yes_align_paren_yes_align_when_yes_wrap_at_when_yes_align_else_yes, lActual)

        oRule.analyze(self.oFile)
        self.assertEqual(oRule.violations, [])
