text stringlengths 1 93.6k |
|---|
# Main(bv, project)
|
if __name__ == '__main__':
|
bv = load(r"D:\TMP\libtprt.so.bndb",options = {
|
"workflows.functionWorkflow":"PythonLogWarnWorkflow",
|
})
|
create_user_func(bv)
|
print_jump_target(bv)
|
# <FILESEP>
|
import unittest
|
import booking as b
|
import os
|
import requests
|
import csv
|
offset = 15
|
rooms = 1
|
country = "Macedonia"
|
start_date = b.default_start_date()
|
end_date = b.default_end_date()
|
class BookingTests(unittest.TestCase):
|
@classmethod
|
def test_get_booking_page(self):
|
""" Verify get_booking_page """
|
session = requests.Session()
|
i = b.get_booking_page(session, offset, rooms, country, start_date, end_date)
|
assert i
|
@classmethod
|
def test_prep_data(self):
|
""" Verify prep_data """
|
i = b.prep_data(rooms, country, start_date, end_date)
|
assert i
|
@classmethod
|
def test_get_countries(self):
|
""" Get Countries """
|
c: list = b.get_countries()
|
assert c != []
|
@classmethod
|
def test_default_start_end_date(self):
|
""" Verify Start/End Date """
|
try:
|
s: str = b.default_start_date()
|
e: str = b.default_end_date()
|
# Assertions
|
assert b.valid_date(s)
|
assert b.valid_date(e)
|
except Exception as err:
|
raise ValueError(err)
|
@classmethod
|
def test_get_excel(self):
|
""" Verify excel output """
|
try:
|
b.get_data(
|
rooms,
|
country,
|
out_format="excel",
|
start_date=b.default_start_date(),
|
end_date=b.default_end_date(),
|
)
|
assert os.path.isfile("hotels-in-{}.xls".format(country))
|
except IOError:
|
print("Failure: File cannot be read.")
|
@classmethod
|
def test_get_csv(self):
|
""" Verify csv output """
|
try:
|
b.get_data(
|
rooms,
|
country,
|
out_format="csv",
|
start_date=b.default_start_date(),
|
end_date=b.default_end_date(),
|
)
|
assert os.path.isfile("hotels-in-{}.csv".format(country))
|
except IOError:
|
print("Failure: File cannot be read.")
|
@classmethod
|
def test_get_default_json(self):
|
""" Verify json output """
|
try:
|
b.get_data(
|
rooms,
|
country,
|
out_format="json",
|
start_date=b.default_start_date(),
|
end_date=b.default_end_date(),
|
)
|
assert os.path.isfile("hotels-in-{}.txt".format(country))
|
except IOError:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.