def test__get_f1_active_energy_3X(self):
        invoice = Invoice(self.invoice_id_3x)

        f1_reactive_energy = invoice.f1_active_energy_kWh
        self.assertListEqual(f1_reactive_energy, [{
            'consum': 307,
            'period': 'P1',
            'source': 'TPL',
            'units': 'kWh'
        }, {
            'consum': 324,
            'period': 'P2',
            'source': 'TPL',
            'units': 'kWh'
        }, {
            'consum': 113,
            'period': 'P3',
            'source': 'TPL',
            'units': 'kWh'
        }, {
            'consum': 94,
            'period': 'P4',
            'source': 'TPL',
            'units': 'kWh'
        }, {
            'consum': 209,
            'period': 'P5',
            'source': 'TPL',
            'units': 'kWh'
        }, {
            'consum': 212,
            'period': 'P6',
            'source': 'TPL',
            'units': 'kWh'
        }])
    def test__get_f1_reactive_energy_3X(self):
        invoice = Invoice(self.invoice_id_3x)

        f1_reactive_energy = invoice.f1_reactive_energy_kVArh
        self.assertListEqual(f1_reactive_energy, [{
            'consum': 41,
            'period': 'P1',
            'source': 'TPL',
            'units': 'kVArh'
        }, {
            'consum': 13,
            'period': 'P2',
            'source': 'TPL',
            'units': 'kVArh'
        }, {
            'consum': 0,
            'period': 'P3',
            'source': 'TPL',
            'units': 'kVArh'
        }, {
            'consum': 11,
            'period': 'P4',
            'source': 'TPL',
            'units': 'kVArh'
        }, {
            'consum': 24,
            'period': 'P5',
            'source': 'TPL',
            'units': 'kVArh'
        }, {
            'consum': 46,
            'period': 'P6',
            'source': 'TPL',
            'units': 'kVArh'
        }])
    def test_f1_measures_2x(self):
        invoice = Invoice(self.invoice_id_2x)

        f1_measures = invoice.f1_measures

        self.assertDictEqual(
            f1_measures,
            self.json4test['invoices_f1_by_contract_id']['contract_data'][0])
    def test__get_f1_active_energy_2X(self):
        invoice = Invoice(self.invoice_id_2x)

        f1_reactive_energy = invoice.f1_active_energy_kWh
        self.assertListEqual(f1_reactive_energy, [{
            'consum': 280,
            'period': 'P1',
            'source': 'Telegestió',
            'units': 'kWh'
        }])
    def test__get_devices(self):
        invoice = Invoice(self.invoice_id_2x)

        devices = invoice.devices
        self.assertListEqual(
            devices, [{
                'dateStart': '2011-12-23T00:00:00-00:15Z',
                'dateEnd': None,
                'deviceId': 'ab201f66-4da7-517b-be40-13b7e0de7429'
            }])
    def test__f1_maximeter(self):
        invoice = Invoice(13281874)

        f1_maximeter = invoice.f1_maximeter
        self.assertListEqual(f1_maximeter, [
            {
                'dateStart': '2021-06-01',
                'dateEnd': '2021-09-10',
                'maxPower': 4.956,
                'period': '2.0TD (P2)'
            },
            {
                'dateStart': '2021-06-01',
                'dateEnd': '2021-09-11',
                'maxPower': 2.632,
                'period': '2.0TD (P1)'
            },
        ])
    def test__f1_power_3X(self):
        invoice = Invoice(self.invoice_id_3x)

        f1_power = invoice.f1_power_kW
        self.assertListEqual(
            f1_power,
            [{
                'excess': 0.0,
                'maximeter': 29.0,
                'period': 'P1',
                'units': 'kW'
            }, {
                'excess': 0.0,
                'maximeter': 12.0,
                'period': 'P2',
                'units': 'kW'
            }, {
                'excess': 0.0,
                'maximeter': 3.0,
                'period': 'P3',
                'units': 'kW'
            }, {
                'excess': 0.0,
                'maximeter': 25.0,
                'period': 'P4',
                'units': 'kW'
            }, {
                'excess': 0.0,
                'maximeter': 26.0,
                'period': 'P5',
                'units': 'kW'
            }, {
                'excess': 0.0,
                'maximeter': 15.0,
                'period': 'P6',
                'units': 'kW'
            }],
        )
    def test__f1_maximeter__without_results(self):
        invoice = Invoice(self.invoice_id_2x)

        f1_maximeter = invoice.f1_maximeter
        self.assertListEqual(f1_maximeter, [])
    def test__get_f1_reactive_energy_2X(self):
        invoice = Invoice(self.invoice_id_2x)

        f1_reactive_energy = invoice.f1_reactive_energy_kVArh
        self.assertListEqual(f1_reactive_energy, [])
    def test__f1_power_2X(self):
        invoice = Invoice(self.invoice_id_2x)

        f1_power = invoice.f1_power_kW
        self.assertListEqual(f1_power, [])
    def test__create_invoice(self):
        invoice = Invoice(self.invoice_id_2x)

        self.assertIsInstance(invoice, Invoice)