import unittest
from unittest.mock import MagicMock, patch
from calculator import Calculator
from mega_number import MegaNumber
class TestCalculator(unittest.TestCase):
def test_call(self):
mock_mega_number = MagicMock(MegaNumber)
mock_mega_number.value = 10
calculator = Calculator()
result = calculator.call(mock_mega_number, 5)
self.assertEqual(result, 15, "The call method should return the sum of MegaNumber's "
"value and the integer provided.")
import matplotlib.pyplot as plt
from PIL import Image
import io
png1 = io.BytesIO()
png2 = io.BytesIO()
x = [1, 2, 3, 4, 5, 6]
y = [8, 13, 14, 11, 16, 22]
plt.plot (x, y)
plt.xlabel('X Variable')
plt.ylabel('Y Variable')
plt.savefig(png1)
y_1 = [1, 2, 3, 4, 5, 6]
x_1 = [8, 13, 14, 11, 16, 22]
plt.plot (x_1, y_1)
plt.xlabel('X Variable')
plt.ylabel('Y Variable')
plt.savefig(png2)
im = Image.open(png1)
im1 = Image.open(png2)
im1.save("output.tiff", format="tiff", append_images=[im], save_all=True, duration=500, loop=0)
#<div\s+class="(.*?)articlePage">[^<>]*(<div[^>]*>(?:[^<>]*|(?1))*</div>)[^<>]*</div>#si
$start = new Carbon('first day of last month');
$end = new Carbon('last day of last month');
$data = array(
'version' => 'AAAAAAmirMM=',
'customer' => array
(
'name' => 'John Doe',
'email' => 'john.doe@example.org',
),
'payment_info' => array
(
0 => array
(
'payment_method_amount' => 90,
'apply_system_credit_amount' => 10,
'billing_method' => array
(
'id' => 'PTLvg3hhYLPUqaBJcHIybjIokxLwR6RHG4zdhF6zZQdZM',
'save' => 1
),
'line_item_payments' => array
(
0 => array
(
'line_item_id' => '4f04bd57-a51b-4d55-85ea-b6f4d7a64090',
'amount' => 40,
'schedule_remaining' => false
),
1 => array
(
'line_item_id' => 'fe591b03-79a6-4d07-a0ac-64574a35896d',
'amount' => 60,
'schedule_remaining' => false
)
)
)
)
);
After download, copy the rabbitmq.4.dll and rabbitmq.4.pdb files to the PHP root folder and copy php_amqp.dll and php_amqp.pdb files to PHP\ext folder
Add extension=amqp to the php.ini file
Check if the module is properly installed with php -m
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.telegram.org/bot598******:AAFx8OAg8dj184XBTldynqezf64trbOQ/sendMessage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\"chat_id\":\"2367*****\",\"text\":\"test message here\"}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;