Ejemplo n.º 1
0
class TestOneColorBlockPattern(InteractionTest):

    """Test the interaction."""

    patterns = load_from_relative_file(__name__, "test_patterns/block4x4.json")
    actions = [
        SwitchOffMachine(),  # no need to switch on the machine for one color
        SwitchCarriageToModeNl(),
        MoveNeedlesIntoPosition("B", [98, 99, 100, 101]),
        MoveCarriageOverLeftHallSensor(),
        PutColorInNutA(None),
        MoveCarriageToTheRight(KnitCarriage()),
        MoveCarriageToTheLeft(KnitCarriage()),
        MoveCarriageToTheRight(KnitCarriage()),
        MoveCarriageToTheLeft(KnitCarriage())]
    machine = KH910
    needle_positions = ["B" * 200] * 4
    left_end_needle = 98
    right_end_needle = 101
Ejemplo n.º 2
0
class Test6x3Pattern(InteractionTest):

    patterns = load_from_relative_file(
        __name__, "test_patterns/block6x3.json")
    actions = [
        SwitchCarriageToModeKc(),
        SwitchOnMachine(),
        MoveNeedlesIntoPosition("B", [97, 98, 99, 100, 101, 102]),
        MoveCarriageOverLeftHallSensor(),
        PutColorInNutA("blue"),
        PutColorInNutB("orange"),
        MoveCarriageToTheRight(KnitCarriage()),
        MoveCarriageToTheLeft(KnitCarriage()),
        MoveCarriageToTheRight(KnitCarriage())]
    machine = KH910
    needle_positions = ["B" * 97 + "DDBBDD" + "B" * 97,
                        "B" * 97 + "BBBBBB" + "B" * 97,
                        "B" * 97 + "DDBBDD" + "B" * 97]
    left_end_needle = 97
    right_end_needle = 102
Ejemplo n.º 3
0
class TestColoredBlockPattern(InteractionTest):

    patterns = load_from_relative_file(
        __name__, "test_patterns/block4x4-colored.json")
    actions = [
        SwitchCarriageToModeKc(),
        SwitchOnMachine(),
        MoveNeedlesIntoPosition("B", [98, 99, 100, 101]),
        MoveCarriageOverLeftHallSensor(),
        PutColorInNutA(None),
        PutColorInNutB("green"),
        MoveCarriageToTheRight(KnitCarriage()),
        MoveCarriageToTheLeft(KnitCarriage()),
        MoveCarriageToTheRight(KnitCarriage()),
        MoveCarriageToTheLeft(KnitCarriage())]
    machine = KH910
    needle_positions = ["B" * (98 + i) + "D" + "B" * (101 - i)
                        for i in range(4)]
    left_end_needle = 98
    right_end_needle = 101
Ejemplo n.º 4
0
 def pattern(self):
     """Teh pattern to test."""
     path = os.path.join("test_patterns", self.FILE)
     pattern_set = load_from_relative_file(__name__, path)
     return pattern_set.patterns[self.PATTERN]
Ejemplo n.º 5
0
def test_test_patterns(pattern_file, expected_ids):
    patterns = load_from_relative_file(__name__, "pattern/" + pattern_file)
    pattern = patterns.patterns.at(0)
    walked_ids = walk_ids(pattern)
    assert walked_ids == expected_ids
def single_instruction_pattern_set():
    """Load the pattern set with only one instruction."""
    return load_from_relative_file(HERE, "pattern/single_instruction.json")
Ejemplo n.º 7
0
def patterns_svg():
    return load_from_relative_file(__name__, "test_patterns/block4x4.json")
def coloring_pattern():
    """The pattern with one colored line and a uncolored line."""
    patterns = load_from_relative_file(__name__, "pattern/inheritance.json")
    return patterns.patterns["color test"]
Ejemplo n.º 9
0
def patterns_svg():
    return load_from_relative_file(__name__, "test_patterns/block4x4.json")
def coloring_pattern():
    """The pattern with one colored line and a uncolored line."""
    patterns = load_from_relative_file(__name__, "pattern/inheritance.json")
    return patterns.patterns["color test"]
Ejemplo n.º 11
0
 def pattern(self):
     """Teh pattern to test."""
     path = os.path.join("test_patterns", self.FILE)
     pattern_set = load_from_relative_file(__name__, path)
     return pattern_set.patterns[self.PATTERN]