def test_electrical_calc_impedance_volt_amp(): test_obj_a = eb.Amp(110, 'A', 50, 'Hz') test_obj_b = eb.Volt(110, 'V', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_impedance() result = (1.0, 'Ohms (V/A)') assert (current_obj.ohm, current_obj.ohm_unit) == result
def test_electrical_calc_impedance_amp_power(): test_obj_a = eb.Amp(10, 'A', 50, 'Hz') test_obj_b = eb.Power(complex(100, 100), 'W', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_impedance() result = ((1 + 1j), 'Ohms (W/A^2)') assert (current_obj.ohm, current_obj.ohm_unit) == result
def test_electrical_calc_voltage_amp_ohms(): test_obj_a = eb.Amp(100, 'A', 50, 'Hz') test_obj_b = eb.Ohm(complex(2, 2), 'Ohms', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_voltage() result = ((200 + 200j), 'Volts (A*Ohms)') assert (current_obj.volts, current_obj.volt_unit) == result
def test_electrical_calc_voltage_amp_power(): test_obj_a = eb.Amp(75, 'A', 50, 'Hz') test_obj_b = eb.Power(complex(75, 75), 'W', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_voltage() result = ((1 + 1j), 'Volts (W/A)') assert (current_obj.volts, current_obj.volt_unit) == result
def test_electrical_calc_current_power_volt(): test_obj_a = eb.Power(complex(1000, 2), 'W', 50, 'Hz') test_obj_b = eb.Volt(25, 'Ohms', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_current() result = ((40 + 0.08j), 'Amps (W/Ohms)') assert (current_obj.amps, current_obj.amp_unit) == result
def test_electrical_calc_current_volts_ohms(): test_obj_a = eb.Volt(1000, 'V', 50, 'Hz') test_obj_b = eb.Ohm(complex(2, 2), 'Ohms', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) current_obj = test_obj_c.calc_current() result = ((250 - 250j), 'Amps (V/Ohms)') assert (current_obj.amps, current_obj.amp_unit) == result
def test_electrical_calc_power_volts_ohms(): test_obj_a = eb.Volt(110, 'V', 50, 'Hz') test_obj_b = eb.Ohm(complex(2, 2), 'Ohms', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) power_obj = test_obj_c.calc_power() result = ((3025 - 3025j), 'V^2/Ohms') assert (power_obj.power, power_obj.power_unit) == result
def test_electrical_calc_current_volt_volt(): test_obj_a = eb.Volt(10, 'V', 50, 'Hz') test_obj_b = eb.Volt(240, 'V', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) power_obj = test_obj_c.calc_current() result = None assert power_obj == result
def test_electrical_calc_power_volt_amp(): test_obj_a = eb.Amp(10, 'A', 50, 'Hz') test_obj_b = eb.Volt(240, 'V', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) power_obj = test_obj_c.calc_power() result = (2400, 'V*A') assert (power_obj.power, power_obj.power_unit) == result
def test_electrical_calc_power_amp_ohms(): test_obj_a = eb.Amp(10, 'A', 50, 'Hz') test_obj_b = eb.Ohm(complex(2, 2), 'Ohms', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) power_obj = test_obj_c.calc_power() result = ((200 + 200j), 'A^2*Ohms') assert (power_obj.power, power_obj.power_unit) == result
def test_electrical_calc_power_volt_amp(): test_obj_a = eb.Amp(10, 'A', 50, 'Hz') test_obj_b = eb.Amp(240, 'A', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_b, test_obj_a) power_obj = test_obj_c.calc_power() result = None assert power_obj == result
def test_electrical_calc_compare_bases(): test_obj_a = eb.Amp(10, 'A', 50, 'Hz') test_obj_b = eb.Volt(240, 'V', 50, 'Hz') test_obj_c = eb.ElectricalCalc(test_obj_a, test_obj_b) result = True assert test_obj_c._freq_equal == result
def test_electrical_calc_determine_same_obj(): test_obj_a = eb.Amp() test_obj_b = eb.Amp() test_obj_c = eb.ElectricalCalc(test_obj_a, test_obj_b) result = False assert test_obj_c._amp_exists == result
def test_electrical_calc_determine_diff_obj(): test_obj_a = eb.Amp() test_obj_b = eb.Volt() test_obj_c = eb.ElectricalCalc(test_obj_a, test_obj_b) result = True assert test_obj_c._amp_exists == result
def test_electrical_calc__init__(): test_obj_a = eb.Amp() test_obj_b = eb.Volt() test_obj_c = eb.ElectricalCalc(test_obj_a, test_obj_b) result = False assert test_obj_c._ohm_exists == result