Exemplo n.º 1
0
class CommandPanel:
    def __init__(self):
        self.resistance = None
        self.mapped_letters = None
        self.resistance_mapper = ResistanceMapper()

    def set_resistance(self, resistance):
        self.resistance = Resistance(resistance)

    def set_mapped_letters(self, mapped_letters):
        self.mapped_letters = mapped_letters

    def find_first_corner_letter(self):
        first_digit = self.resistance.get_first_digit()
        index = first_digit - 1
        return Letter[self.mapped_letters[index]]
# résistances entre 10^2 et 10^6 ohms
import argparse

from scripts.src.mapping.resistance import Resistance
from scripts.src.mapping.resistance_mapper import ResistanceMapper

if __name__ == '__main__':
    AP = argparse.ArgumentParser()
    AP.add_argument("-r", "--resistance", help="path to the image")
    ARGS = vars(AP.parse_args())

    resistance = Resistance(int(ARGS["resistance"]))

    resistance_mapper = ResistanceMapper()

    print(resistance_mapper.find_colors(resistance))
Exemplo n.º 3
0
 def set_resistance(self, resistance):
     self.resistance = Resistance(resistance)
 def test_when_round_then_resistance_is_as_expected_6(self):
     resistance = Resistance(self.A_RESISTANCE_6)
     rounded_resistance, _ = resistance.get_resistance_and_colors()
     assert rounded_resistance == self.EXPECTED_RESISTANCE_6