uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
181079561e0a4b3b3fb70a84
train
class
class XenAPILiveMigrateTestCase(stubs.XenAPITestBaseNoDB): """Unit tests for live_migration.""" def setUp(self): super(XenAPILiveMigrateTestCase, self).setUp() self.flags(connection_url='test_url', connection_password='test_pass', group='xenserver') ...
class XenAPILiveMigrateTestCase(stubs.XenAPITestBaseNoDB):
"""Unit tests for live_migration.""" def setUp(self): super(XenAPILiveMigrateTestCase, self).setUp() self.flags(connection_url='test_url', connection_password='test_pass', group='xenserver') self.flags(firewall_driver='nova.virt.xenapi.firewall.' ...
_rpcapi._mock_calls) def test_slave_asks_master_to_remove_slave_from_pool(self): slave = ResourcePoolWithStubs() slave.remove_from_aggregate("CONTEXT", self.fake_aggregate, "slave") self.assertIn( (slave.compute_rpcapi.remove_aggregate_host, "CONTEXT", 98, "slave",...
255
256
4,361
19
236
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
XenAPILiveMigrateTestCase
XenAPILiveMigrateTestCase
3,360
3,830
3,360
3,360
1a7c69bd2ff677f45b803167845580a4b581ae2f
bigcode/the-stack
train
a5b483c4c1b12fbde6d29f14
train
class
class XenAPISRSelectionTestCase(stubs.XenAPITestBaseNoDB): """Unit tests for testing we find the right SR.""" def test_safe_find_sr_raise_exception(self): # Ensure StorageRepositoryNotFound is raise when wrong filter. self.flags(sr_matching_filter='yadayadayada', group='xenserver') stubs...
class XenAPISRSelectionTestCase(stubs.XenAPITestBaseNoDB):
"""Unit tests for testing we find the right SR.""" def test_safe_find_sr_raise_exception(self): # Ensure StorageRepositoryNotFound is raise when wrong filter. self.flags(sr_matching_filter='yadayadayada', group='xenserver') stubs.stubout_session(self.stubs, stubs.FakeSessionForVMTests) ...
== chain_name] jump_rules = [rule for rule in inst_rules if '-j' in rule.rule] provjump_rules = [] # IptablesTable doesn't make rules unique internally for rule in jump_rules: if 'provider' in rule.rule and rule not in provjump_rules: provjump_rules.append(ru...
182
182
609
17
165
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
XenAPISRSelectionTestCase
XenAPISRSelectionTestCase
2,913
2,966
2,913
2,913
1d6d55946e781eb263cbf03e41eb03caf8949bb1
bigcode/the-stack
train
c72650d7561d5799800dddd5
train
class
class XenAPIMigrateInstance(stubs.XenAPITestBase): """Unit test for verifying migration-related actions.""" REQUIRES_LOCKING = True def setUp(self): super(XenAPIMigrateInstance, self).setUp() self.flags(connection_url='test_url', connection_password='test_pass', ...
class XenAPIMigrateInstance(stubs.XenAPITestBase):
"""Unit test for verifying migration-related actions.""" REQUIRES_LOCKING = True def setUp(self): super(XenAPIMigrateInstance, self).setUp() self.flags(connection_url='test_url', connection_password='test_pass', group='xenserver') self.flags(fi...
.compute_shared(alice_pub) self.assertEqual(alice_shared, bob_shared) def _test_encryption(self, message): enc = self.alice.encrypt(message) self.assertFalse(enc.endswith('\n')) dec = self.bob.decrypt(enc) self.assertEqual(dec, message) def test_encrypt_simple_message(s...
256
256
3,953
14
241
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
XenAPIMigrateInstance
XenAPIMigrateInstance
1,639
2,017
1,639
1,639
f043487226f495ac778e0c22a840deb1e1433650
bigcode/the-stack
train
8744c819efe9f36e7396c983
train
class
class XenAPIVMTestCase(stubs.XenAPITestBase): """Unit tests for VM operations.""" def setUp(self): super(XenAPIVMTestCase, self).setUp() self.useFixture(test.SampleNetworks()) self.network = importutils.import_object(CONF.network_manager) self.fixture = self.useFixture(config_fix...
class XenAPIVMTestCase(stubs.XenAPITestBase):
"""Unit tests for VM operations.""" def setUp(self): super(XenAPIVMTestCase, self).setUp() self.useFixture(test.SampleNetworks()) self.network = importutils.import_object(CONF.network_manager) self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF)) self.fixt...
(self.instance['name'], 'Running') conn_info = self._make_connection_info() self.assertIsNone( conn.attach_volume(None, conn_info, self.instance, '/dev/sdc')) # check that the VM has a VBD attached to it # Get XenAPI record for VBD vbds = xenapi_fake.get_all('VBD') ...
256
256
12,505
15
240
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
XenAPIVMTestCase
XenAPIVMTestCase
285
1,596
285
285
65f37e402062bb65b34443f5ff4db9e859d4f796
bigcode/the-stack
train
2c98015fedba27249b8b4343
train
class
class ToSupportedInstancesTestCase(test.NoDBTestCase): def test_default_return_value(self): self.assertEqual([], host.to_supported_instances(None)) def test_return_value(self): self.assertEqual([(arch.X86_64, hv_type.XEN, 'xen')], host.to_supported_instances([u'xen-3.0-...
class ToSupportedInstancesTestCase(test.NoDBTestCase):
def test_default_return_value(self): self.assertEqual([], host.to_supported_instances(None)) def test_return_value(self): self.assertEqual([(arch.X86_64, hv_type.XEN, 'xen')], host.to_supported_instances([u'xen-3.0-x86_64'])) def test_invalid_values_do_not_break(se...
stats = self.conn.host_state.get_host_stats(refresh=True) self.assertEqual('foo', stats['hypervisor_hostname']) stats = self.conn.host_state.get_host_stats(refresh=True) self.assertEqual('foo', stats['hypervisor_hostname']) class ToSupportedInstancesTestCase(test.NoDBTestCase):
63
64
211
12
51
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
ToSupportedInstancesTestCase
ToSupportedInstancesTestCase
2,248
2,268
2,248
2,248
af40fd64cb0a92059d1a3c2ad49576db8bb391db
bigcode/the-stack
train
a779edcd16f8c1085a2407f2
train
class
class XenAPIHostTestCase(stubs.XenAPITestBase): """Tests HostState, which holds metrics from XenServer that get reported back to the Schedulers. """ def setUp(self): super(XenAPIHostTestCase, self).setUp() self.flags(connection_url='test_url', connection_password='tes...
class XenAPIHostTestCase(stubs.XenAPITestBase):
"""Tests HostState, which holds metrics from XenServer that get reported back to the Schedulers. """ def setUp(self): super(XenAPIHostTestCase, self).setUp() self.flags(connection_url='test_url', connection_password='test_pass', group='xenserver') ...
('root', vm_utils.ImageType.DISK_RAW) def test_get_image_role_disk_vhd(self): self._assert_role('root', vm_utils.ImageType.DISK_VHD) class XenAPIDetermineDiskImageTestCase(test.NoDBTestCase): """Unit tests for code that detects the ImageType.""" def assert_disk_type(self, image_meta, expected_dis...
256
256
1,673
14
241
JohnGarbutt/nova
nova/tests/unit/virt/xenapi/test_xenapi.py
Python
XenAPIHostTestCase
XenAPIHostTestCase
2,073
2,245
2,073
2,073
5a37a8f7401f4ddb85aeed81c595af9d8317ec39
bigcode/the-stack
train
74583881b218eedd2a3c48c6
train
class
class Subversion(VersionControl): name = 'svn' dirname = '.svn' repo_name = 'checkout' schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn') def get_base_rev_args(self, rev): return ['-r', rev] def get_info(self, location): """Returns (url, revision), where both are ...
class Subversion(VersionControl):
name = 'svn' dirname = '.svn' repo_name = 'checkout' schemes = ('svn', 'svn+ssh', 'svn+http', 'svn+https', 'svn+svn') def get_base_rev_args(self, rev): return ['-r', rev] def get_info(self, location): """Returns (url, revision), where both are strings""" assert not loca...
from __future__ import absolute_import import logging import os import re from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._internal.index import Link from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import display_path, remove_auth_from_url, rmtree from pip._in...
196
256
1,652
7
189
kpinc/pip
src/pip/_internal/vcs/subversion.py
Python
Subversion
Subversion
25
222
25
25
d32237668fdb68cd7e200f0f11a21a9f566d30ba
bigcode/the-stack
train
7fcd7cc9c6a6368f3935753a
train
function
def get_rev_options(vcs, url, rev): """ Return a RevOptions object. """ r = urllib_parse.urlsplit(url) if hasattr(r, 'username'): # >= Python-2.5 username, password = r.username, r.password else: netloc = r[1] if '@' in netloc: auth = netloc.split('@')...
def get_rev_options(vcs, url, rev):
""" Return a RevOptions object. """ r = urllib_parse.urlsplit(url) if hasattr(r, 'username'): # >= Python-2.5 username, password = r.username, r.password else: netloc = r[1] if '@' in netloc: auth = netloc.split('@')[0] if ':' in auth: ...
_revision(location) return 'svn+%s@%s#egg=%s' % (repo, rev, egg_project_name) def is_commit_id_equal(self, dest, name): """Always assume the versions don't match""" return False def get_rev_options(vcs, url, rev):
64
64
178
11
52
kpinc/pip
src/pip/_internal/vcs/subversion.py
Python
get_rev_options
get_rev_options
225
250
225
225
a320240c96afed033dc217c78fa8f7f806df534a
bigcode/the-stack
train
16b9a5a70726030756c5eaab
train
function
def is_iss_overhead(): response = requests.get(url="http://api.open-notify.org/iss-now.json") response.raise_for_status() data = response.json() iss_latitude = float(data["iss_position"]["latitude"]) iss_longitude = float(data["iss_position"]["longitude"]) # Your position is within +5 or -5 de...
def is_iss_overhead():
response = requests.get(url="http://api.open-notify.org/iss-now.json") response.raise_for_status() data = response.json() iss_latitude = float(data["iss_position"]["latitude"]) iss_longitude = float(data["iss_position"]["longitude"]) # Your position is within +5 or -5 degrees of the iss positi...
import requests from datetime import datetime import smtplib import time MY_EMAIL = "email@gmail.com" MY_PASSWORD = "" MY_LAT = 22.279199 MY_LONG = 114.171809 def is_iss_overhead():
53
64
115
7
45
Jackson-Miller/python-boot-camp
Day 33/IIS Overhead Notifier/main.py
Python
is_iss_overhead
is_iss_overhead
13
23
13
13
aff1db81836211e8ae5961de059fdb3f1515cb7d
bigcode/the-stack
train
3355408aa9d6336945fbabec
train
function
def is_night(): parameters = { "lat": MY_LAT, "lng": MY_LONG, "formatted": 0, } response = requests.get("https://api.sunrise-sunset.org/json", params=parameters) response.raise_for_status() data = response.json() sunrise = int(data["results"]["sunrise"].split("T")[1].spli...
def is_night():
parameters = { "lat": MY_LAT, "lng": MY_LONG, "formatted": 0, } response = requests.get("https://api.sunrise-sunset.org/json", params=parameters) response.raise_for_status() data = response.json() sunrise = int(data["results"]["sunrise"].split("T")[1].split(":")[0]) s...
float(data["iss_position"]["longitude"]) # Your position is within +5 or -5 degrees of the iss position. if MY_LAT-5 <= iss_latitude <= MY_LAT+5 and MY_LONG-5 <= iss_longitude <= MY_LONG+5: return True def is_night():
64
64
133
5
58
Jackson-Miller/python-boot-camp
Day 33/IIS Overhead Notifier/main.py
Python
is_night
is_night
26
41
26
26
30bbf37434b305f14025c1dc6ca33f42fda2688c
bigcode/the-stack
train
5e6276289cd370cb2688b7cb
train
function
def delete_runtime(name, config=None): config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) runtimes = compute_handler.list_run...
def delete_runtime(name, config=None):
config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) runtimes = compute_handler.list_runtimes(name) for runtime in runtimes...
, file, config=None): config = default_config(config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) compute_handler.build_runtime(name, file) create_runtime(name, config=config) update_runtime(name, config=config) def delete_runtime(name, config=None)...
64
64
109
8
56
erezh16/pywren-ibm-cloud
pywren_ibm_cloud/runtime/utils.py
Python
delete_runtime
delete_runtime
82
93
82
82
3af5e390de0db8b36df65958c4deb48a40c59938
bigcode/the-stack
train
7373e016930a8baeb16d786b
train
function
def clean_runtimes(config=None): logger.info('Cleaning all runtimes and cache information') config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute...
def clean_runtimes(config=None):
logger.info('Cleaning all runtimes and cache information') config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) # Clean loc...
(compute_config) runtimes = compute_handler.list_runtimes(name) for runtime in runtimes: compute_handler.delete_runtime(runtime[0], runtime[1]) runtime_key = compute_handler.get_runtime_key(runtime[0], runtime[1]) internal_storage.delete_runtime_meta(runtime_key) def clean_runtimes(conf...
70
70
234
8
62
erezh16/pywren-ibm-cloud
pywren_ibm_cloud/runtime/utils.py
Python
clean_runtimes
clean_runtimes
96
122
96
96
6e30d0c0b74727fb3c93ef9f43388e8c66f6a900
bigcode/the-stack
train
9a6cdc183fe4d64433ec7d13
train
function
def create_runtime(name, memory=None, config=None): config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) memory = config['pywre...
def create_runtime(name, memory=None, config=None):
config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) memory = config['pywren']['runtime_memory'] if not memory else memory ...
STORAGE_PREFIX_DEFAULT, default_config, extract_storage_config, extract_compute_config from pywren_ibm_cloud.storage import InternalStorage from pywren_ibm_cloud.compute import Compute TEMP = tempfile.gettempdir() logger = logging.getLogger(__name__) def create_runtime(name, memory=None, config=None):
64
64
169
11
53
erezh16/pywren-ibm-cloud
pywren_ibm_cloud/runtime/utils.py
Python
create_runtime
create_runtime
30
47
30
30
4e8ddb506e493aed579d4a981a3bbcbad5b0504f
bigcode/the-stack
train
11be7bafc990abde54a1b2c8
train
function
def build_runtime(name, file, config=None): config = default_config(config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) compute_handler.build_runtime(name, file) create_runtime(name, config=config) update_runtime(name, config=config)
def build_runtime(name, file, config=None):
config = default_config(config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) compute_handler.build_runtime(name, file) create_runtime(name, config=config) update_runtime(name, config=config)
compute_handler.create_runtime(runtime[0], runtime[1], timeout) try: internal_storage.put_runtime_meta(runtime_key, runtime_meta) except Exception: raise("Unable to upload 'preinstalled-modules' file into {}".format(internal_storage.backend)) def build_runtime(name, file, confi...
64
64
60
10
54
erezh16/pywren-ibm-cloud
pywren_ibm_cloud/runtime/utils.py
Python
build_runtime
build_runtime
72
79
72
72
e5bcf2ff975608f4565110984043d98b620eba8a
bigcode/the-stack
train
ac8393964b703a51ee18a980
train
function
def update_runtime(name, config=None): config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) timeout = config['pywren']['runtime...
def update_runtime(name, config=None):
config = default_config(config) storage_config = extract_storage_config(config) internal_storage = InternalStorage(storage_config) compute_config = extract_compute_config(config) compute_handler = Compute(compute_config) timeout = config['pywren']['runtime_timeout'] logger.info('Updating ru...
runtime_meta = compute_handler.create_runtime(name, memory, timeout=timeout) try: internal_storage.put_runtime_meta(runtime_key, runtime_meta) except Exception: raise("Unable to upload 'preinstalled-modules' file into {}".format(internal_storage.backend)) def update_runtime(name, config=Non...
64
64
168
8
56
erezh16/pywren-ibm-cloud
pywren_ibm_cloud/runtime/utils.py
Python
update_runtime
update_runtime
50
69
50
50
8bd4e7f35d1ff6c793b0ac18b9be6de2cc4fa7d3
bigcode/the-stack
train
284dcc3bc945f542448dd5b1
train
function
def connect_all_issues_signals(): connect_issues_signals() connect_issues_custom_attributes_signals()
def connect_all_issues_signals():
connect_issues_signals() connect_issues_custom_attributes_signals()
als(): from taiga.projects.custom_attributes import signals as custom_attributes_handlers signals.post_save.connect(custom_attributes_handlers.create_custom_attribute_value_when_create_issue, sender=apps.get_model("issues", "Issue"), dispatch_uid="cre...
64
64
24
8
56
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
connect_all_issues_signals
connect_all_issues_signals
47
49
47
47
714ebccddaf81cbde4dc287d562c7efe589d236e
bigcode/the-stack
train
a566580df94a0599586c3503
train
function
def disconnect_all_issues_signals(): disconnect_issues_signals() disconnect_issues_custom_attributes_signals()
def disconnect_all_issues_signals():
disconnect_issues_signals() disconnect_issues_custom_attributes_signals()
=apps.get_model("issues", "Issue"), dispatch_uid="tags_normalization_issue") def disconnect_issues_custom_attributes_signals(): signals.post_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="create_custom_attribute_value_when_c...
64
64
24
8
56
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
disconnect_all_issues_signals
disconnect_all_issues_signals
64
66
64
64
99cc63274b183ed6398e8239f3c544cb7a6faeaf
bigcode/the-stack
train
c201e8d25c3afb6be7b341b8
train
class
class IssuesAppConfig(AppConfig): name = "taiga.projects.issues" verbose_name = "Issues" def ready(self): connect_all_issues_signals()
class IssuesAppConfig(AppConfig):
name = "taiga.projects.issues" verbose_name = "Issues" def ready(self): connect_all_issues_signals()
_custom_attributes_signals(): signals.post_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="create_custom_attribute_value_when_create_issue") def disconnect_all_issues_signals(): disconnect_issues_signals() disconnect_issues_custom_attributes_signals...
64
64
37
7
57
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
IssuesAppConfig
IssuesAppConfig
69
74
69
69
2423e6639d986d076cd0466ac68b88127232cd36
bigcode/the-stack
train
bdfaadcd40acb64a781e66e7
train
function
def disconnect_issues_signals(): signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="set_finished_date_when_edit_issue") signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="tags_normal...
def disconnect_issues_signals():
signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="set_finished_date_when_edit_issue") signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="tags_normalization_issue")
_handlers.create_custom_attribute_value_when_create_issue, sender=apps.get_model("issues", "Issue"), dispatch_uid="create_custom_attribute_value_when_create_issue") def connect_all_issues_signals(): connect_issues_signals() connect_issues_custom_attr...
64
64
59
7
57
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
disconnect_issues_signals
disconnect_issues_signals
52
56
52
52
51e4dd70e8425139d6d11c3d16e8b2c0a528a48b
bigcode/the-stack
train
0c76fe5ec9674a9ee29b5e08
train
function
def connect_issues_custom_attributes_signals(): from taiga.projects.custom_attributes import signals as custom_attributes_handlers signals.post_save.connect(custom_attributes_handlers.create_custom_attribute_value_when_create_issue, sender=apps.get_model("issues", "Issue"), ...
def connect_issues_custom_attributes_signals():
from taiga.projects.custom_attributes import signals as custom_attributes_handlers signals.post_save.connect(custom_attributes_handlers.create_custom_attribute_value_when_create_issue, sender=apps.get_model("issues", "Issue"), dispatch_uid="create_cus...
_model("issues", "Issue"), dispatch_uid="set_finished_date_when_edit_issue") # Tags signals.pre_save.connect(tagging_handlers.tags_normalization, sender=apps.get_model("issues", "Issue"), dispatch_uid="tags_normalization_iss...
64
64
63
9
55
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
connect_issues_custom_attributes_signals
connect_issues_custom_attributes_signals
39
44
39
39
249a4d06696280e4b8588f05776bf3ecb9b38a04
bigcode/the-stack
train
f9fdeaad14171ffa359ae875
train
function
def connect_issues_signals(): from taiga.projects.tagging import signals as tagging_handlers from . import signals as handlers # Finished date signals.pre_save.connect(handlers.set_finished_date_when_edit_issue, sender=apps.get_model("issues", "Issue"), ...
def connect_issues_signals():
from taiga.projects.tagging import signals as tagging_handlers from . import signals as handlers # Finished date signals.pre_save.connect(handlers.set_finished_date_when_edit_issue, sender=apps.get_model("issues", "Issue"), dispatch_uid="set_fin...
details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from django.apps import AppConfig from django.apps import apps from django.db.models import signals def connect_issues_signals():
64
64
107
7
56
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
connect_issues_signals
connect_issues_signals
24
36
24
24
744befa1ce76c90feb029f19729ea9cc7f284e01
bigcode/the-stack
train
bda6ccda29191abb5a871caa
train
function
def disconnect_issues_custom_attributes_signals(): signals.post_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="create_custom_attribute_value_when_create_issue")
def disconnect_issues_custom_attributes_signals():
signals.post_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="create_custom_attribute_value_when_create_issue")
_signals(): signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="set_finished_date_when_edit_issue") signals.pre_save.disconnect(sender=apps.get_model("issues", "Issue"), dispatch_uid="tags_normalization_issue") def d...
64
64
37
9
55
mattcongy/itshop
docker-images/taigav2/taiga-back/taiga/projects/issues/apps.py
Python
disconnect_issues_custom_attributes_signals
disconnect_issues_custom_attributes_signals
59
61
59
59
f2584a6ed2cf47301b8859a9b507523500a5906e
bigcode/the-stack
train
374c58e8bbfa5e405e37af60
train
class
class UCB(MNLBanditLearner): """UCB policy :cite:`DBLP:journals/ior/AgrawalAGZ19` :param np.ndarray revenues: product revenues :param Reward reward: reward the learner wants to maximize :param int card_limit: cardinality constraint :param bool use_local_search: whether to use local search for searching the ...
class UCB(MNLBanditLearner):
"""UCB policy :cite:`DBLP:journals/ior/AgrawalAGZ19` :param np.ndarray revenues: product revenues :param Reward reward: reward the learner wants to maximize :param int card_limit: cardinality constraint :param bool use_local_search: whether to use local search for searching the best assortment :param i...
from typing import Optional import numpy as np from banditpylib.bandits import search_best_assortment, Reward, \ local_search_best_assortment from banditpylib.data_pb2 import Context, Actions, Feedback from .utils import MNLBanditLearner class UCB(MNLBanditLearner):
74
256
886
11
62
Alanthink/banditpylib
banditpylib/learners/mnl_bandit_learner/ucb.py
Python
UCB
UCB
11
114
11
11
58c4babac003fa4f919d24436aaa812047e318b8
bigcode/the-stack
train
de24911b5400dfec5566a46a
train
class
class RedRpoints(OWRpy): globalSettingsList = ['commit'] def __init__(self, **kwargs): OWRpy.__init__(self, **kwargs) self.setRvariableNames(["points"]) self.data = {} self.RFunctionParam_y = '' self.RFunctionParam_x = '' self.RFunctionParam_col = '' ...
class RedRpoints(OWRpy):
globalSettingsList = ['commit'] def __init__(self, **kwargs): OWRpy.__init__(self, **kwargs) self.setRvariableNames(["points"]) self.data = {} self.RFunctionParam_y = '' self.RFunctionParam_x = '' self.RFunctionParam_col = '' self.inputs.addInput('...
""" <name>points</name> <tags>Plotting</tags> <icon></icon> """ from OWRpy import * import redRGUI, signals import redRGUI import libraries.plotting.signalClasses as plotsigs class RedRpoints(OWRpy):
61
227
757
10
50
PiRSquared17/r-orange
libraries/plotting/widgets/RedRpoints.py
Python
RedRpoints
RedRpoints
13
79
13
13
cce833cc6a2f161c0d46ea3c3479782ebc2b32f5
bigcode/the-stack
train
5bda09d537c61920651ab0de
train
function
@assert_no_logs def test_layout_table_auto_22(): # Auto-width table with column group with widths as percentages and pixels page, = render_pages(''' <table> <colgroup style="width: 10%"> <col /> <col /> </colgroup> <colgroup style="width: 200px"> <col ...
@assert_no_logs def test_layout_table_auto_22(): # Auto-width table with column group with widths as percentages and pixels
page, = render_pages(''' <table> <colgroup style="width: 10%"> <col /> <col /> </colgroup> <colgroup style="width: 200px"> <col /> <col /> </colgroup> <tbody> <tr> <td>a a</td> <td>a b</td> ...
assert td_1.width == 100 assert td_2.width == 100 assert td_3.width == 150 assert td_4.width == 150 assert table.width == 500 @assert_no_logs def test_layout_table_auto_22(): # Auto-width table with column group with widths as percentages and pixels
77
77
258
28
48
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_22
test_layout_table_auto_22
914
948
914
916
678295cdcb813cd2ec9e7c722a21c57291a10139
bigcode/the-stack
train
5798efc5a58a9e2911dcba3a
train
function
@assert_no_logs def test_layout_table_auto_39(): page, = render_pages(''' <table> <tr> <td> <table style="display: inline-table"> <tr> <td style="width: 100%;"></td> <td></td> </tr> </table> </td> ...
@assert_no_logs def test_layout_table_auto_39():
page, = render_pages(''' <table> <tr> <td> <table style="display: inline-table"> <tr> <td style="width: 100%;"></td> <td></td> </tr> </table> </td> </tr> </table> ''')
100%;"></td> <td style="width: 48px;"> <img src="icon.png"> </td> </tr> </table> </td> </tr> </table> ''') @assert_no_logs def test_layout_table_auto_39():
64
64
89
13
51
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_39
test_layout_table_auto_39
1,223
1,238
1,223
1,224
d2ca3d7dc33cb0f2236852f05e8214ff4855843e
bigcode/the-stack
train
627366934aab07891efc0341
train
function
@assert_no_logs def test_layout_table_auto_48(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685 page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-family: ahem; border-spacing: 100px; border-coll...
@assert_no_logs def test_layout_table_auto_48(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685
page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-family: ahem; border-spacing: 100px; border-collapse: collapse"> <tr> <td colspan=5>aaa</td> </tr> </table> ''') html, = page.ch...
row, = row_group.children td, = row.children assert td.width == 48 # 3 * font-size @assert_no_logs def test_layout_table_auto_48(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685
64
64
187
35
28
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_48
test_layout_table_auto_48
1,467
1,487
1,467
1,470
0df6000c0860f80cb13dba6d78bfa9c669efcfc2
bigcode/the-stack
train
24bfe81357f3aa614dbbc08c
train
function
@assert_no_logs def test_layout_table_auto_31(): # Test a table with column widths < table width < column width + spacing page, = render_pages(''' <table style="width: 300px; border-spacing: 2px"> <td style="width: 299px"></td> </table> ''')
@assert_no_logs def test_layout_table_auto_31(): # Test a table with column widths < table width < column width + spacing
page, = render_pages(''' <table style="width: 300px; border-spacing: 2px"> <td style="width: 299px"></td> </table> ''')
="max-width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> ''') @assert_no_logs def test_layout_table_auto_31(): # Test a table with column widths < table width < column width + spacing
64
64
76
30
34
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_31
test_layout_table_auto_31
1,094
1,101
1,094
1,096
2ed3a620b547d39fc832ef0e8e4ea63ed96ba5f2
bigcode/the-stack
train
85aebaba254e0f11c632eb24
train
function
@assert_no_logs @pytest.mark.parametrize('vertical_align, table_position_y', ( ('top', 8), ('bottom', 8), ('baseline', 10), )) def test_inline_table_baseline(vertical_align, table_position_y): # Check that inline table's baseline is its first row's baseline. # # Div text's baseline is at 18px fr...
@assert_no_logs @pytest.mark.parametrize('vertical_align, table_position_y', ( ('top', 8), ('bottom', 8), ('baseline', 10), )) def test_inline_table_baseline(vertical_align, table_position_y): # Check that inline table's baseline is its first row's baseline. # # Div text's baseline is at 18px fr...
page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <div style="font-family: ahem; font-size: 10px; line-height: 30px"> abc <table style="display: inline-table; border-collapse: collapse; line-height: 10px"> <tr...
@assert_no_logs @pytest.mark.parametrize('vertical_align, table_position_y', ( ('top', 8), ('bottom', 8), ('baseline', 10), )) def test_inline_table_baseline(vertical_align, table_position_y): # Check that inline table's baseline is its first row's baseline. # # Div text's baseline is at 18px fr...
206
126
423
206
0
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_inline_table_baseline
test_inline_table_baseline
2,576
2,615
2,576
2,594
cdb4c31eb8c93269cc72cf2951f224d9c79dbc0c
bigcode/the-stack
train
f9d1f7a7e23e9c55a7194a6d
train
function
@assert_no_logs def test_layout_table_auto_6(): page, = render_pages(''' <style> @page { size: 100px 1000px; } </style> <table style="border-spacing: 1px; margin-right: 79px; font-size: 0"> <tr> <td><img src=pattern.png></td> <td> <img src=pattern.pn...
@assert_no_logs def test_layout_table_auto_6():
page, = render_pages(''' <style> @page { size: 100px 1000px; } </style> <table style="border-spacing: 1px; margin-right: 79px; font-size: 0"> <tr> <td><img src=pattern.png></td> <td> <img src=pattern.png> <img src=pattern.png> <img src=pa...
table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, td_2, td_3 = row.children assert table.width == 1000 assert td_1.width == 40 assert td_2.width == 11 * 16 assert td_3.width == 1000 - 40 - 11 * 16 @assert_no_lo...
113
113
379
13
99
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_6
test_layout_table_auto_6
411
448
411
412
fef43bc8b83961b8491127c4f47f52f821659d21
bigcode/the-stack
train
4a9ef2e35ffd9db4bcf71fce
train
function
@assert_no_logs def test_layout_table_auto_35(): # Div with auto width containing a table with a cell larger than the # table's max-width page, = render_pages(''' <div style="float: left"> <table style="max-width: 300px; margin: 100px"> <td style="width: 400px"></td> </table>...
@assert_no_logs def test_layout_table_auto_35(): # Div with auto width containing a table with a cell larger than the # table's max-width
page, = render_pages(''' <div style="float: left"> <table style="max-width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> </div> ''') html, = page.children body, = html.children div, = body.children table_wrapper, = div.children assert d...
+ 2 * 100 assert table_wrapper.margin_width() == 600 # 400 + 2 * 100 @assert_no_logs def test_layout_table_auto_35(): # Div with auto width containing a table with a cell larger than the # table's max-width
64
64
165
36
27
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_35
test_layout_table_auto_35
1,152
1,168
1,152
1,155
636baaaba48611208fe76dd24c33f1b02da7d5e5
bigcode/the-stack
train
bd2f49abdcfa9c270ac5db64
train
function
@assert_no_logs def test_layout_table_auto_11(): page, = render_pages(''' <table style="border-spacing: 0"> <tr> <td style="width: 10px"></td> <td colspan="3"></td> </tr> <tr> <td colspan="2" style="width: 22px"></td> <td style="width: 8px"></td>...
@assert_no_logs def test_layout_table_auto_11():
page, = render_pages(''' <table style="border-spacing: 0"> <tr> <td style="width: 10px"></td> <td colspan="3"></td> </tr> <tr> <td colspan="2" style="width: 22px"></td> <td style="width: 8px"></td> <td style="width: 8px"></td> <...
_2 = row.children assert table_wrapper.position_x == 0 assert table.position_x == 10 # 0 + margin-left assert td_1.position_x == 10 assert td_1.width == 6 # 14 - 8 assert td_2.position_x == 16 # 10 + 6 assert td_2.width == 8 # maximum of the minimum widths for the column assert table.wid...
119
119
397
13
105
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_11
test_layout_table_auto_11
572
611
572
573
c9448e49215a2c01e3ee1b7c34803b927ca5b99a
bigcode/the-stack
train
4849c49da057423b4f2cf36c
train
function
@assert_no_logs @pytest.mark.parametrize( 'body_width, table_width, check_width, positions, widths', ( ('500px', '230px', 220, [170, 5], [45, 155]), ('530px', '100%', 520, [395, 5], [120, 380]), ) ) def test_explicit_width_table_percent_rtl(body_width, table_width, check_width, ...
@assert_no_logs @pytest.mark.parametrize( 'body_width, table_width, check_width, positions, widths', ( ('500px', '230px', 220, [170, 5], [45, 155]), ('530px', '100%', 520, [395, 5], [120, 380]), ) ) def test_explicit_width_table_percent_rtl(body_width, table_width, check_width, ...
page, = render_pages(''' <style> body { width: %s } table { width: %s; table-layout: fixed; direction: rtl; border-collapse: collapse; font-size: 1px } td, th { border: 10px solid } </style> <table style=""> <col style="width: 25%%"></col> <c...
assert td_21.width == 240 # 15 * font_size @assert_no_logs @pytest.mark.parametrize( 'body_width, table_width, check_width, positions, widths', ( ('500px', '230px', 220, [170, 5], [45, 155]), ('530px', '100%', 520, [395, 5], [120, 380]), ) ) def test_explicit_width_table_percent_rtl(body_wi...
115
115
385
98
16
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_explicit_width_table_percent_rtl
test_explicit_width_table_percent_rtl
1,539
1,580
1,539
1,547
8c5fc467ffa22dfd8bfa685f7ac46222bab7234f
bigcode/the-stack
train
a21e79b2e609e3a30bf4e0b7
train
function
@assert_no_logs def test_layout_table_auto_10(): page, = render_pages(''' <table style="border-spacing: 0; width: 14px; margin: 10px"> <colgroup> <col /> <col style="width: 6px" /> </colgroup> <tr> <td><img src=pattern.png><img src=pattern.png></td> ...
@assert_no_logs def test_layout_table_auto_10():
page, = render_pages(''' <table style="border-spacing: 0; width: 14px; margin: 10px"> <colgroup> <col /> <col style="width: 6px" /> </colgroup> <tr> <td><img src=pattern.png><img src=pattern.png></td> <td style="width: 8px"></td> </tr> ...
2.position_x == 85 # 15 + 60 + border-spacing assert td_4.position_x == 85 assert td_3.width == 60 assert td_4.width == 30 assert table.width == 120 # 60 + 30 + 3 * border-spacing @assert_no_logs def test_layout_table_auto_10():
82
82
274
13
68
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_10
test_layout_table_auto_10
542
569
542
543
9e0f0c4c0ab1a4a9c28b0964e4b1f38350f77402
bigcode/the-stack
train
f16157ccb25bac56c6f3a7a6
train
function
@assert_no_logs def test_layout_table_auto_34(): # Div with auto width containing an empty table with a min-width page, = render_pages(''' <div style="float: left"> <table style="min-width: 400px; margin: 100px"></table> </div> ''') html, = page.children body, = html.children ...
@assert_no_logs def test_layout_table_auto_34(): # Div with auto width containing an empty table with a min-width
page, = render_pages(''' <div style="float: left"> <table style="min-width: 400px; margin: 100px"></table> </div> ''') html, = page.children body, = html.children div, = body.children table_wrapper, = div.children assert div.margin_width() == 600 # 400 + 2 * 100 asse...
() == 600 # 400 + 2 * 100 assert table_wrapper.margin_width() == 600 # 400 + 2 * 100 @assert_no_logs def test_layout_table_auto_34(): # Div with auto width containing an empty table with a min-width
64
64
142
28
35
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_34
test_layout_table_auto_34
1,136
1,149
1,136
1,138
3ba72ca35eda9dfc2c353f98ee91ab8d849aab81
bigcode/the-stack
train
d0631c2e19353b60b445631a
train
function
@assert_no_logs def test_table_row_height_3(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/ page, = render_pages(''' <style> @font-face { src: url(AHEM____.TTF); font-family: ahem } </style> <table style="border-spacing: 0; font-family: ahem; line-height: 20px"> ...
@assert_no_logs def test_table_row_height_3(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/
page, = render_pages(''' <style> @font-face { src: url(AHEM____.TTF); font-family: ahem } </style> <table style="border-spacing: 0; font-family: ahem; line-height: 20px"> <tr><td>Table</td><td rowspan="2"></td></tr> <tr></tr> </table> ''') html, = page.childre...
= page.children body, = html.children wrapper, = body.children table, = wrapper.children row_group, = table.children @assert_no_logs def test_table_row_height_3(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/
64
64
207
31
32
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_row_height_3
test_table_row_height_3
1,841
1,862
1,841
1,843
668597cc88acb6b62615a0c3a3c34fad02d1ef14
bigcode/the-stack
train
b7ba8e52c14b9812c17a2680
train
function
@assert_no_logs def test_layout_table_auto_19(): # Column group width page, = render_pages(''' <table style="width: 200px"> <colgroup style="width: 100px"> <col /> <col /> </colgroup> <col style="width: 100px" /> <tbody> <tr> <td>a<...
@assert_no_logs def test_layout_table_auto_19(): # Column group width
page, = render_pages(''' <table style="width: 200px"> <colgroup style="width: 100px"> <col /> <col /> </colgroup> <col style="width: 100px" /> <tbody> <tr> <td>a</td> <td>a</td> <td>abc</td> </tr> ...
row, = row_group.children td_1, td_2 = row.children assert td_1.width == 140 assert td_2.width == 60 assert table.width == 200 @assert_no_logs def test_layout_table_auto_19(): # Column group width
66
66
220
19
46
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_19
test_layout_table_auto_19
813
842
813
815
777c1e4f5971a9feeb96ea8c6a835cd430fbeee3
bigcode/the-stack
train
4408ed7dec700a89e0c87ebe
train
function
@assert_no_logs def test_layout_table_fixed_3(): page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; width: 110px; margin: 5px"> <tr> <td style="width: 40px">a</td> <td>b</td> </tr> <tr> <td style="width: 5...
@assert_no_logs def test_layout_table_fixed_3():
page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; width: 110px; margin: 5px"> <tr> <td style="width: 40px">a</td> <td>b</td> </tr> <tr> <td style="width: 50px">a</td> <td style="width: 30px">b</...
_1.width == 75 # 20 + ((200 - 20 - 40 - 3 * border-spacing) / 2) assert td_2.position_x == 100 # 15 + 75 + border-spacing assert td_2.width == 95 # 40 + ((200 - 20 - 40 - 3 * border-spacing) / 2) assert table.width == 200 @assert_no_logs def test_layout_table_fixed_3():
105
105
353
13
91
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_fixed_3
test_layout_table_fixed_3
143
176
143
144
6f9d76c4c57b582e6b037aebe4d401c0f14120b2
bigcode/the-stack
train
3b08d0b753718e15c788a2a8
train
function
@assert_no_logs def test_table_page_breaks_complex_2(): pages = render_pages(''' <style> @page { size: 250px } td { height: 40px } table { table-layout: fixed; width: 100%; break-before: avoid } </style> <table> <thead> <tr><td>head 1</td></tr> </t...
@assert_no_logs def test_table_page_breaks_complex_2():
pages = render_pages(''' <style> @page { size: 250px } td { height: 40px } table { table-layout: fixed; width: 100%; break-before: avoid } </style> <table> <thead> <tr><td>head 1</td></tr> </thead> <tbody> <tr><td>row 1 1</td></tr...
else: table, = table_wrapper.children for group in table.children: assert group.children, 'found an empty table group' rows = [] for row in group.children: cell, = row.children line, = cell.children ...
149
150
500
15
134
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_breaks_complex_2
test_table_page_breaks_complex_2
2,131
2,188
2,131
2,132
2fab586808fffc529519dfcffe26ad92a3de41c9
bigcode/the-stack
train
ef354ac62e15df75f2321abc
train
function
@assert_no_logs def test_implicit_width_table_col_percent(): # See https://github.com/Kozea/WeasyPrint/issues/169 page, = render_pages(''' <table> <col style="width:25%"></col> <col></col> <tr> <td></td> <td></td> </tr> </table> ''') html, ...
@assert_no_logs def test_implicit_width_table_col_percent(): # See https://github.com/Kozea/WeasyPrint/issues/169
page, = render_pages(''' <table> <col style="width:25%"></col> <col></col> <tr> <td></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children r...
border-spacing assert table_wrapper.margin_width() == 90 # 80 + 2 * margin assert text.position_x == 90 @assert_no_logs def test_implicit_width_table_col_percent(): # See https://github.com/Kozea/WeasyPrint/issues/169
64
64
147
32
31
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_implicit_width_table_col_percent
test_implicit_width_table_col_percent
46
65
46
48
52d5055a6f39f4f6e1fc617406f5c9e9e17faae4
bigcode/the-stack
train
c05f063424dc9c8e69d272ab
train
function
@assert_no_logs def test_table_page_breaks_complex_1(): pages = render_pages(''' <style> @page { size: 100px } </style> <h1 style="margin: 0; height: 30px">Lipsum</h1> <!-- Leave 70px on the first page: enough for the header or row1 but not both. --> <table style="b...
@assert_no_logs def test_table_page_breaks_complex_1():
pages = render_pages(''' <style> @page { size: 100px } </style> <h1 style="margin: 0; height: 30px">Lipsum</h1> <!-- Leave 70px on the first page: enough for the header or row1 but not both. --> <table style="border-spacing: 0; font-size: 5px"> <thead> ...
else: body_children = body.children if not body_children: rows_per_page.append(0) continue table_wrapper, = body_children table, = table_wrapper.children rows_in_this_page = 0 for group in table.children: assert group.children, 'fo...
143
143
477
15
127
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_breaks_complex_1
test_table_page_breaks_complex_1
2,077
2,128
2,077
2,078
02d76a738153245bac9cac6d22ba035f1c762f27
bigcode/the-stack
train
025cadc3f62d4ea179ab7463
train
function
@assert_no_logs def test_layout_table_auto_38(): page, = render_pages(''' <table> <tr> <td> <table> <tr> <td style="width: 100%;"></td> <td style="width: 48px;"> <img src="icon.png"> </td> ...
@assert_no_logs def test_layout_table_auto_38():
page, = render_pages(''' <table> <tr> <td> <table> <tr> <td style="width: 100%;"></td> <td style="width: 48px;"> <img src="icon.png"> </td> </tr> </table> </td> ...
> <td style="min-width: 100%;"></td> <td style="width: 48px;"></td> </tr> </table> </td> </tr> </table> ''') @assert_no_logs def test_layout_table_auto_38():
64
64
100
13
51
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_38
test_layout_table_auto_38
1,203
1,220
1,203
1,204
c9dba649cf45a110081e3aa42814aea563001f4e
bigcode/the-stack
train
63215c8c2e82349058f1bfc9
train
function
@assert_no_logs def test_layout_table_auto_47(): # Test regression: # https://github.com/Kozea/WeasyPrint/issues/666 page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-family: ahem"> <tr> <td colspan=5>aaa</td> ...
@assert_no_logs def test_layout_table_auto_47(): # Test regression: # https://github.com/Kozea/WeasyPrint/issues/666
page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-family: ahem"> <tr> <td colspan=5>aaa</td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children ...
.width == 200 assert div.width == 340 # 200 + 2 * 50 + 2 * 20 @assert_no_logs def test_layout_table_auto_47(): # Test regression: # https://github.com/Kozea/WeasyPrint/issues/666
64
64
174
35
28
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_47
test_layout_table_auto_47
1,445
1,464
1,445
1,448
26fad06dce530157a82ce39c3c92860fb2431004
bigcode/the-stack
train
eb8029c441f92abf981ea2c6
train
function
def test_table_break_children_margin(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/1254 html = ''' <style> @page { size: 100px } p { height: 20px; margin-top: 50px } </style> <table> <tr><td><p>Page1</p></td></tr> <tr><td><p>Page2</p></td></tr...
def test_table_break_children_margin(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/1254
html = ''' <style> @page { size: 100px } p { height: 20px; margin-top: 50px } </style> <table> <tr><td><p>Page1</p></td></tr> <tr><td><p>Page2</p></td></tr> <tr><td><p>Page3</p></td></tr> </table> ''' assert len(render_pages(html)) == 3
: cell, = row.children line, = cell.children text, = line.children rows.append(text.text) assert rows == rows_expected[i] def test_table_break_children_margin(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/1254
64
64
138
28
36
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_break_children_margin
test_table_break_children_margin
2,730
2,743
2,730
2,731
5de1819a107d88adcba12b9546fe06f055d843d5
bigcode/the-stack
train
58d9fdbbcb72f4d3a9740318
train
function
@assert_no_logs def test_layout_table_auto_26(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/307 # Table with a cell larger than the table's max-width page, = render_pages(''' <table style="max-width: 300px"> <td style="width: 400px"></td> </table> ''')
@assert_no_logs def test_layout_table_auto_26(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/307 # Table with a cell larger than the table's max-width
page, = render_pages(''' <table style="max-width: 300px"> <td style="width: 400px"></td> </table> ''')
assert td_2.width == 60 assert table.width == 200 @assert_no_logs def test_layout_table_auto_26(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/307 # Table with a cell larger than the table's max-width
64
64
87
47
16
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_26
test_layout_table_auto_26
1,041
1,049
1,041
1,044
b201893c9e3ef5a66d94bc54399799d91176eac1
bigcode/the-stack
train
784228eb335f7591792c4b9f
train
function
@assert_no_logs def test_layout_table_fixed_4(): page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 0; width: 100px; margin: 10px"> <colgroup> <col /> <col style="width: 20px" /> </colgroup> <tr> <td></td> ...
@assert_no_logs def test_layout_table_fixed_4():
page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 0; width: 100px; margin: 10px"> <colgroup> <col /> <col style="width: 20px" /> </colgroup> <tr> <td></td> <td style="width: 40px">a</td> </tr>...
65 # 15 + 40 + border-spacing assert td_4.position_x == 65 assert td_3.width == 40 assert td_4.width == 40 assert table.width == 110 # 20 + 40 + 3 * border-spacing @assert_no_logs def test_layout_table_fixed_4():
78
78
260
13
64
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_fixed_4
test_layout_table_fixed_4
179
207
179
180
896ffccf781202f20ef63c0a7f86ae0612ea7314
bigcode/the-stack
train
04b22b0b35caf2165a84cd62
train
function
@assert_no_logs def test_layout_table_auto_44(): # Cells widths as percentages on normal and colspan cells page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%" colspan=2>a a a a a ...
@assert_no_logs def test_layout_table_auto_44(): # Cells widths as percentages on normal and colspan cells
page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%" colspan=2>a a a a a a a a</td> <td>a a a a a a a a</td> <td style="width: 40%">a a a a a a a a</td> ...
.children row, = row_group.children td_1, td_2, td_3 = row.children assert td_1.width == 35 assert td_2.width == 30 assert td_3.width == 35 assert table.width == 100 @assert_no_logs def test_layout_table_auto_44(): # Cells widths as percentages on normal and colspan cells
89
89
297
25
63
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_44
test_layout_table_auto_44
1,342
1,373
1,342
1,344
47713f99acc64aaa9edb58cd60371481ddb264d3
bigcode/the-stack
train
650ccfec54c6f1ff4348ed28
train
function
@assert_no_logs def test_table_row_height_2(): # A cell box cannot extend beyond the last row box of a table. page, = render_pages(''' <table style="border-spacing: 0"> <tr style="height: 10px"> <td rowspan=5></td> <td></td> </tr> <tr style="height: 10px"> ...
@assert_no_logs def test_table_row_height_2(): # A cell box cannot extend beyond the last row box of a table.
page, = render_pages(''' <table style="border-spacing: 0"> <tr style="height: 10px"> <td rowspan=5></td> <td></td> </tr> <tr style="height: 10px"> <td></td> </tr> </table> ''') html, = page.children body, = html.children wrapp...
[103, 103, 103, 103, 103, 103], [283, 283], [], [513] ] @assert_no_logs def test_table_row_height_2(): # A cell box cannot extend beyond the last row box of a table.
63
64
142
29
34
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_row_height_2
test_table_row_height_2
1,820
1,838
1,820
1,822
2ddca8ae72ce4c4fc0831154dbef879e46801962
bigcode/the-stack
train
6805ca846e5349f68bfd7e4a
train
function
@assert_no_logs def test_layout_table_fixed_2(): page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; width: 200px; margin: 5px"> <tr> <td style="width: 20px">a</td> <td style="width: 40px"></td> </tr> </table> ''')...
@assert_no_logs def test_layout_table_fixed_2():
page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; width: 200px; margin: 5px"> <tr> <td style="width: 20px">a</td> <td style="width: 40px"></td> </tr> </table> ''') html, = page.children body, = html.child...
_x == 15 # 5 + border-spacing assert td_1.width == 20 assert td_2.position_x == 45 # 15 + 20 + border-spacing assert td_2.width == 40 assert table.width == 90 # 20 + 40 + 3 * border-spacing @assert_no_logs def test_layout_table_fixed_2():
87
87
291
13
73
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_fixed_2
test_layout_table_fixed_2
116
140
116
117
d3311784fbfe29d6431b9067407a6e16c5a4e192
bigcode/the-stack
train
4e3f7e593b387803ffad10d8
train
function
@assert_no_logs def test_table_html_tag(): # Non-regression test: this used to cause an exception page, = render_pages('<html style="display: table">')
@assert_no_logs def test_table_html_tag(): # Non-regression test: this used to cause an exception
page, = render_pages('<html style="display: table">')
table.margin_height() == 500 # no margin assert wrapper.height == 500 assert wrapper.margin_height() == 700 # 500 + 2*100 @assert_no_logs def test_table_html_tag(): # Non-regression test: this used to cause an exception
64
64
40
25
38
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_html_tag
test_table_html_tag
1,957
1,960
1,957
1,959
cb90baf73bd2805b3238547a7d0841606b53e21e
bigcode/the-stack
train
69043b8f7edc86979dddb1ac
train
function
@assert_no_logs def test_layout_table_auto_8(): page, = render_pages(''' <table style="border-spacing: 10px; width: 120px; margin: 5px; font-size: 0"> <tr> <td style="width: 20px"><img src=pattern.png></td> <td><img src=pattern.png style="width: 40px"></td> ...
@assert_no_logs def test_layout_table_auto_8():
page, = render_pages(''' <table style="border-spacing: 10px; width: 120px; margin: 5px; font-size: 0"> <tr> <td style="width: 20px"><img src=pattern.png></td> <td><img src=pattern.png style="width: 40px"></td> </tr> </table> ''') html, = pa...
0 + border-spacing assert td_1.width == 20 assert td_2.position_x == 45 # 15 + 20 + border-spacing assert td_2.width == 40 assert table.width == 90 # 20 + 40 + 3 * border-spacing @assert_no_logs def test_layout_table_auto_8():
81
81
272
13
67
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_8
test_layout_table_auto_8
480
504
480
481
d127651df77a013d79e82f55fb83c29521bc73b1
bigcode/the-stack
train
bf50f46ec7c87d8cad33a21e
train
function
@assert_no_logs def test_layout_table_auto_40(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/368 # Check that white-space is used for the shrink-to-fit algorithm page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="width...
@assert_no_logs def test_layout_table_auto_40(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/368 # Check that white-space is used for the shrink-to-fit algorithm
page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="width: 0"> <td style="font-family: ahem; white-space: nowrap">a a</td> </table> ''') html, = page.children body, = html.children div, = body.children table_wra...
> </td> </tr> </table> ''') @assert_no_logs def test_layout_table_auto_40(): # Test regression: https://github.com/Kozea/WeasyPrint/issues/368 # Check that white-space is used for the shrink-to-fit algorithm
64
64
168
48
16
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_40
test_layout_table_auto_40
1,241
1,256
1,241
1,244
97a7fa6da01a7e85309bcb5b0e4324482847f60c
bigcode/the-stack
train
a114aa721f94fe9d548ef338
train
function
@assert_no_logs def test_layout_table_auto_25(): # Column width and cell width as percentage page, = render_pages(''' <div style="width: 400px"> <table style="width: 50%"> <colgroup> <col style="width: 70%" /> <col /> </colgroup> <tbody> ...
@assert_no_logs def test_layout_table_auto_25(): # Column width and cell width as percentage
page, = render_pages(''' <div style="width: 400px"> <table style="width: 50%"> <colgroup> <col style="width: 70%" /> <col /> </colgroup> <tbody> <tr> <td>a</td> <td style="width: 30%">abc</td> </t...
.children td_1, td_2 = row.children assert td_1.width == 140 assert td_2.width == 60 assert table.width == 200 @assert_no_logs def test_layout_table_auto_25(): # Column width and cell width as percentage
65
65
218
23
41
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_25
test_layout_table_auto_25
1,009
1,038
1,009
1,011
32ed8247ad5b80527b57436a4f33eea180979dfc
bigcode/the-stack
train
856084dd30ae432eafb174f1
train
function
@assert_no_logs @pytest.mark.parametrize('rows_expected, thead, tfoot, content', ( ([[], ['Header', 'Footer']], 45, 45, '<p>content</p>'), ([[], ['Header', 'Footer']], 85, 5, '<p>content</p>'), ([['Header', 'Footer']], 30, 30, '<p>content</p>'), ([[], ['Header']], 30, 110, '<p>content</p>'), ([[], [...
@assert_no_logs @pytest.mark.parametrize('rows_expected, thead, tfoot, content', ( ([[], ['Header', 'Footer']], 45, 45, '<p>content</p>'), ([[], ['Header', 'Footer']], 85, 5, '<p>content</p>'), ([['Header', 'Footer']], 30, 30, '<p>content</p>'), ([[], ['Header']], 30, 110, '<p>content</p>'), ([[], [...
html = ''' <style> @page { size: 100px } p { height: 20px } thead th { height: %spx } tfoot th { height: %spx } </style> %s <table> <thead><tr><th>Header</th></tr></thead> <tfoot><tr><th>Footer</th></tr></tfoot> </table> ''' % (thead,...
@assert_no_logs @pytest.mark.parametrize('rows_expected, thead, tfoot, content', ( ([[], ['Header', 'Footer']], 45, 45, '<p>content</p>'), ([[], ['Header', 'Footer']], 85, 5, '<p>content</p>'), ([['Header', 'Footer']], 30, 30, '<p>content</p>'), ([[], ['Header']], 30, 110, '<p>content</p>'), ([[], [...
300
162
540
300
0
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_empty_body
test_table_empty_body
2,676
2,727
2,676
2,696
e495ef7737c1fd8df8293ca7a8809fdbeee7188a
bigcode/the-stack
train
488495d18e95242dabe9aad0
train
function
@assert_no_logs def test_layout_table_auto_41(): # Cell width as percentage in auto-width table page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> ...
@assert_no_logs def test_layout_table_auto_41(): # Cell width as percentage in auto-width table
page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> </tr> </tbody> </table> </div> ''') html, = page.children body...
body, = html.children div, = body.children table_wrapper, = div.children table, = table_wrapper.children assert table.width == 16 * 3 @assert_no_logs def test_layout_table_auto_41(): # Cell width as percentage in auto-width table
64
64
202
24
39
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_41
test_layout_table_auto_41
1,259
1,284
1,259
1,261
b3be782b1db1836e094a1d6a1ad3470039a408d5
bigcode/the-stack
train
54e53f5e6f7a418e271ebf6f
train
function
@assert_no_logs def test_layout_table_auto_5(): page, = render_pages(''' <style> @font-face { src: url(AHEM____.TTF); font-family: ahem } * { font-family: ahem } </style> <table style="width: 1000px; font-family: ahem"> <tr> <td style="width: 40px">aa aa aa aa</td...
@assert_no_logs def test_layout_table_auto_5():
page, = render_pages(''' <style> @font-face { src: url(AHEM____.TTF); font-family: ahem } * { font-family: ahem } </style> <table style="width: 1000px; font-family: ahem"> <tr> <td style="width: 40px">aa aa aa aa</td> <td style="width: 40px">aaaaaaaaaaa<...
assert td_12.width == 4 assert td_22.width == 10 # 4 + 2 * 3 assert table.width == 27 # 3 * spacing + 4 + 4 + 2 * b1 + 2 * b2 @assert_no_logs def test_layout_table_auto_5():
76
76
255
13
62
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_5
test_layout_table_auto_5
382
408
382
383
37c100e313035e4ef852358196426611e72089e8
bigcode/the-stack
train
2877343e92e34dcd66495140
train
function
@assert_no_logs def test_layout_table_auto_29(): # Table with a cell larger than the table's width and max-width page, = render_pages(''' <table style="width: 300px; max-width: 350px"> <td style="padding: 50px"> <div style="width: 300px"></div> </td> </table> ''')
@assert_no_logs def test_layout_table_auto_29(): # Table with a cell larger than the table's width and max-width
page, = render_pages(''' <table style="width: 300px; max-width: 350px"> <td style="padding: 50px"> <div style="width: 300px"></div> </td> </table> ''')
style="width: 300px; max-width: 350px"> <td style="width: 400px"></td> </table> ''') @assert_no_logs def test_layout_table_auto_29(): # Table with a cell larger than the table's width and max-width
64
64
90
29
35
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_29
test_layout_table_auto_29
1,072
1,081
1,072
1,074
95519340104fa38b804117065b1c6ae435f02d37
bigcode/the-stack
train
a3e178cbfa1fcde2df0fddda
train
function
@assert_no_logs def test_layout_table_fixed_5(): # With border-collapse page, = render_pages(''' <style> /* Do not apply: */ colgroup, col, tbody, tr, td { margin: 1000px } </style> <table style="table-layout: fixed; border-collapse: collapse; border: 10px s...
@assert_no_logs def test_layout_table_fixed_5(): # With border-collapse
page, = render_pages(''' <style> /* Do not apply: */ colgroup, col, tbody, tr, td { margin: 1000px } </style> <table style="table-layout: fixed; border-collapse: collapse; border: 10px solid; /* ignored with collapsed borders: */ ...
table.children row, = row_group.children td_1, td_2 = row.children assert table_wrapper.position_x == 0 assert table.position_x == 10 # 0 + margin-left assert td_1.position_x == 10 assert td_1.width == 80 # 100 - 20 assert td_2.position_x == 90 # 10 + 80 assert td_2.width == 20 a...
132
132
440
19
112
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_fixed_5
test_layout_table_fixed_5
210
250
210
212
dce22e17cdaa5e27d62cb69c7a4e9cabf090116c
bigcode/the-stack
train
37f37bc98b8b2c1340964f6c
train
function
@assert_no_logs def test_table_caption_margin_bottom(): page, = render_pages(''' <style> table { margin: 20px; } caption, h1, h2 { margin: 20px; height: 10px; caption-side: bottom } td { height: 10px } </style> <h1></h1> <table> <caption></caption> <tr...
@assert_no_logs def test_table_caption_margin_bottom():
page, = render_pages(''' <style> table { margin: 20px; } caption, h1, h2 { margin: 20px; height: 10px; caption-side: bottom } td { height: 10px } </style> <h1></h1> <table> <caption></caption> <tr> <td></td> </tr> </table> ...
20, 50) assert (caption.content_box_x(), caption.content_box_y()) == (40, 70) assert (tbody.content_box_x(), tbody.content_box_y()) == (20, 100) assert (h2.content_box_x(), h2.content_box_y()) == (20, 130) @assert_no_logs def test_table_caption_margin_bottom():
79
79
265
12
67
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_caption_margin_bottom
test_table_caption_margin_bottom
2,647
2,673
2,647
2,648
9219697597ffb462c9c4c779057427f564ff8376
bigcode/the-stack
train
986ae42071ee66ed9ab461ed
train
function
@assert_no_logs def test_layout_table_auto_30(): # Table with a cell larger than the table's max-width page, = render_pages(''' <table style="max-width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> ''')
@assert_no_logs def test_layout_table_auto_30(): # Table with a cell larger than the table's max-width
page, = render_pages(''' <table style="max-width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> ''')
px"> <td style="padding: 50px"> <div style="width: 300px"></div> </td> </table> ''') @assert_no_logs def test_layout_table_auto_30(): # Table with a cell larger than the table's max-width
64
64
73
27
37
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_30
test_layout_table_auto_30
1,084
1,091
1,084
1,086
c513e0be7a41a229109c3ac6be73ea004a5f68b3
bigcode/the-stack
train
d66251987fb4c4dbc64da451
train
function
@assert_no_logs def test_layout_table_auto_20(): # Multiple column width page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 50px" /> <col style="width: 30px" /> <col /> </colgroup> <tbody> <tr> <td...
@assert_no_logs def test_layout_table_auto_20(): # Multiple column width
page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 50px" /> <col style="width: 30px" /> <col /> </colgroup> <tbody> <tr> <td>a</td> <td>a</td> <td>abc</td> </tr> ...
2, td_3 = row.children assert td_1.width == 100 assert td_2.width == 100 assert td_3.width == 100 assert table.width == 300 @assert_no_logs def test_layout_table_auto_20(): # Multiple column width
66
66
221
19
46
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_20
test_layout_table_auto_20
845
874
845
847
38ff1a62467a8418bb146e7882174a69444ec36d
bigcode/the-stack
train
6412f4f397cc79b0ac1fb2eb
train
function
@assert_no_logs def test_layout_table_auto_45(): # Cells widths as percentage on multiple lines page, = render_pages(''' <div style="width: 1000px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> ...
@assert_no_logs def test_layout_table_auto_45(): # Cells widths as percentage on multiple lines
page, = render_pages(''' <div style="width: 1000px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> <td>a a a a a a a a</td> <td style="width: 40%">a a a a a a a a</td> ...
, = body.children table_wrapper, = div.children table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, td_2, td_3, td_4, td_5 = row.children assert td_1.width == 10 assert td_2.width == 30 assert td_3.width == 10 assert td_4.width == 40 assert...
142
142
475
23
118
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_45
test_layout_table_auto_45
1,376
1,416
1,376
1,378
4d5230cab158e37a72fc4dde0f7cefefef746e82
bigcode/the-stack
train
14f21ffa089a11e02d684a01
train
function
@assert_no_logs def test_layout_table_auto_46(): # Test regression: # http://test.weasyprint.org/suite-css21/chapter8/section2/test56/ page, = render_pages(''' <div style="position: absolute"> <table style="margin: 50px; border: 20px solid black"> <tr> <td style="width: 2...
@assert_no_logs def test_layout_table_auto_46(): # Test regression: # http://test.weasyprint.org/suite-css21/chapter8/section2/test56/
page, = render_pages(''' <div style="position: absolute"> <table style="margin: 50px; border: 20px solid black"> <tr> <td style="width: 200px; height: 200px"></td> </tr> </table> </div> ''') html, = page.children body, = html.children div, ...
% assert td_23.width == 420 # 42% assert table.width == 1000 @assert_no_logs def test_layout_table_auto_46(): # Test regression: # http://test.weasyprint.org/suite-css21/chapter8/section2/test56/
64
64
214
40
23
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_46
test_layout_table_auto_46
1,419
1,442
1,419
1,422
d19526db3685b4c1a91f1fad83ffd3aadb69f335
bigcode/the-stack
train
1a9946cf1259a865e869e4f5
train
function
@assert_no_logs def test_table_page_break_before(): page1, page2, page3, page4, page5, page6 = render_pages(''' <style> @page { size: 1000px } h1 { height: 30px} td { height: 40px } table { table-layout: fixed; width: 100% } </style> <h1>Dummy title</h1> <tabl...
@assert_no_logs def test_table_page_break_before():
page1, page2, page3, page4, page5, page6 = render_pages(''' <style> @page { size: 1000px } h1 { height: 30px} td { height: 40px } table { table-layout: fixed; width: 100% } </style> <h1>Dummy title</h1> <table> <tbody> <tr style="break-befor...
= body.children table, = table_wrapper.children table_group1, table_group2 = table.children assert len(table_group1.children) == 2 assert len(table_group2.children) == 3 html, = page3.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children tabl...
205
205
684
12
193
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_break_before
test_table_page_break_before
2,272
2,350
2,272
2,273
d19cbf114b2d830f63f6213ac97168ca4fb328fd
bigcode/the-stack
train
ff5ed53c40d7f3e449312c9f
train
function
@assert_no_logs def test_layout_table_auto_37(): # Other crashes: https://github.com/Kozea/WeasyPrint/issues/305 page, = render_pages(''' <table> <tr> <td> <table> <tr> <th>Test</th> </tr> <tr> <td styl...
@assert_no_logs def test_layout_table_auto_37(): # Other crashes: https://github.com/Kozea/WeasyPrint/issues/305
page, = render_pages(''' <table> <tr> <td> <table> <tr> <th>Test</th> </tr> <tr> <td style="min-width: 100%;"></td> <td style="width: 48px;"></td> </tr> </table> ...
152 page, = render_pages(''' <table> <td style="width: 50%"> </table> ''') @assert_no_logs def test_layout_table_auto_37(): # Other crashes: https://github.com/Kozea/WeasyPrint/issues/305
64
64
127
33
31
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_37
test_layout_table_auto_37
1,181
1,200
1,181
1,183
33a9f7da60156c6d99d5d257bb9fb645f6c57429
bigcode/the-stack
train
b2c34a203c1251e9ea7eb75f
train
function
@assert_no_logs def test_layout_table_auto_13(): # Regression tests: these used to crash page, = render_pages(''' <table style="width: 30px"> <tr> <td colspan=2></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_w...
@assert_no_logs def test_layout_table_auto_13(): # Regression tests: these used to crash
page, = render_pages(''' <table style="width: 30px"> <tr> <td colspan=2></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children ...
.width == 12 # 32 - 10 - sp assert td_33.width == 26 # 2 * 8 + sp assert table.width == 88 @assert_no_logs def test_layout_table_auto_13(): # Regression tests: these used to crash
64
64
178
23
40
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_13
test_layout_table_auto_13
656
676
656
658
cb1dbd5edb5f6550a5f5024363b247496e0c522a
bigcode/the-stack
train
465d9acb6500de63f1a90ec1
train
function
@assert_no_logs def test_inline_table(): page, = render_pages(''' <table style="display: inline-table; border-spacing: 10px; margin: 5px"> <tr> <td><img src=pattern.png style="width: 20px"></td> <td><img src=pattern.png style="width: 30px"></td> </tr> </table> f...
@assert_no_logs def test_inline_table():
page, = render_pages(''' <table style="display: inline-table; border-spacing: 10px; margin: 5px"> <tr> <td><img src=pattern.png style="width: 20px"></td> <td><img src=pattern.png style="width: 30px"></td> </tr> </table> foo ''') html, = page.children ...
""" weasyprint.tests.layout.table ----------------------------- Tests for layout of tables. """ import pytest from ..test_boxes import render_pages from ..test_draw import assert_pixels from ..testing_utils import assert_no_logs, capture_logs @assert_no_logs def test_inline_table():
62
89
298
10
51
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_inline_table
test_inline_table
16
43
16
17
a505bd7014e00b5acd8c8231ebcc047b8000e2c1
bigcode/the-stack
train
00cd015971d76f77d22a6c4a
train
function
@assert_no_logs @pytest.mark.parametrize('html, rows, positions', ( (''' <style> @page { size: 120px } table { table-layout: fixed; width: 100% } h1 { height: 30px } td { height: 40px } </style> <h1>Dummy title</h1> <table> <tr><td>row 1</td></tr> ...
@assert_no_logs @pytest.mark.parametrize('html, rows, positions', ( (''' <style> @page { size: 120px } table { table-layout: fixed; width: 100% } h1 { height: 30px } td { height: 40px } </style> <h1>Dummy title</h1> <table> <tr><td>row 1</td></tr> ...
pages = render_pages(html) rows_per_page = [] rows_position_y = [] for i, page in enumerate(pages): html, = page.children body, = html.children if i == 0: body_children = body.children[1:] # skip h1 else: body_children = body.children if n...
@assert_no_logs @pytest.mark.parametrize('html, rows, positions', ( (''' <style> @page { size: 120px } table { table-layout: fixed; width: 100% } h1 { height: 30px } td { height: 40px } </style> <h1>Dummy title</h1> <table> <tr><td>row 1</td></tr> ...
751
256
945
751
0
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_breaks
test_table_page_breaks
1,963
2,074
1,963
2,048
f4454ad79ed66ea4ac00e8a86f3c44cb8845b534
bigcode/the-stack
train
efe17c0a217e1fbeff60ea96
train
function
@assert_no_logs def test_layout_table_auto_27(): # Table with a cell larger than the table's width page, = render_pages(''' <table style="width: 300px"> <td style="width: 400px"></td> </table> ''')
@assert_no_logs def test_layout_table_auto_27(): # Table with a cell larger than the table's width
page, = render_pages(''' <table style="width: 300px"> <td style="width: 400px"></td> </table> ''')
, = render_pages(''' <table style="max-width: 300px"> <td style="width: 400px"></td> </table> ''') @assert_no_logs def test_layout_table_auto_27(): # Table with a cell larger than the table's width
64
64
65
26
38
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_27
test_layout_table_auto_27
1,052
1,059
1,052
1,054
c6c6f0f716f17370c8012765b7128ed31b9ab921
bigcode/the-stack
train
9485c6ee57bc735ae8009482
train
function
@assert_no_logs def test_layout_table_auto_32(): # Table with a cell larger than the table's width page, = render_pages(''' <table style="width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> ''') html, = page.children body, = html.children table_wrapper, = bo...
@assert_no_logs def test_layout_table_auto_32(): # Table with a cell larger than the table's width
page, = render_pages(''' <table style="width: 300px; margin: 100px"> <td style="width: 400px"></td> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children assert table_wrapper.margin_width() == 600 # 400 + 2 * 100
<table style="width: 300px; border-spacing: 2px"> <td style="width: 299px"></td> </table> ''') @assert_no_logs def test_layout_table_auto_32(): # Table with a cell larger than the table's width
64
64
114
26
38
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_32
test_layout_table_auto_32
1,104
1,115
1,104
1,106
0f9fb3978fff10d751e92fb733225d95c1b485c9
bigcode/the-stack
train
49c1c3677967f5416abd536a
train
function
@assert_no_logs def test_layout_table_auto_17(): # With border-collapse page, = render_pages(''' <style> /* Do not apply: */ colgroup, col, tbody, tr, td { margin: 1000px } </style> <table style="border-collapse: collapse; border: 10px solid; /* ignored with...
@assert_no_logs def test_layout_table_auto_17(): # With border-collapse
page, = render_pages(''' <style> /* Do not apply: */ colgroup, col, tbody, tr, td { margin: 1000px } </style> <table style="border-collapse: collapse; border: 10px solid; /* ignored with collapsed borders: */ border-spacing: 10000px; padding:...
table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, td_2 = row.children assert td_1.width == 20 # 2 / 3 * 30 assert td_2.width == 10 # 1 / 3 * 30 a...
130
130
434
19
110
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_17
test_layout_table_auto_17
742
781
742
744
82b4db65dd4466aa68d55b08b786ef778734ae6f
bigcode/the-stack
train
6de849e9e9f5579879156fe5
train
function
@assert_no_logs def test_layout_table_auto_36(): # Test regression on a crash: https://github.com/Kozea/WeasyPrint/pull/152 page, = render_pages(''' <table> <td style="width: 50%"> </table> ''')
@assert_no_logs def test_layout_table_auto_36(): # Test regression on a crash: https://github.com/Kozea/WeasyPrint/pull/152
page, = render_pages(''' <table> <td style="width: 50%"> </table> ''')
2 * 100 assert table_wrapper.margin_width() == 600 # 400 + 2 * 100 @assert_no_logs def test_layout_table_auto_36(): # Test regression on a crash: https://github.com/Kozea/WeasyPrint/pull/152
64
64
66
37
26
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_36
test_layout_table_auto_36
1,171
1,178
1,171
1,173
7161f8d1566864ab4f573479baa613e18fb1ff72
bigcode/the-stack
train
f08c97f785e94253c20a2bd5
train
function
@assert_no_logs def test_table_row_height_1(): page, = render_pages(''' <table style="width: 1000px; border-spacing: 0 100px; font: 20px/1em serif; margin: 3px; table-layout: fixed"> <tr> <td rowspan=0 style="height: 420px; vertical-align: top"></td> <td>X<br>X<...
@assert_no_logs def test_table_row_height_1():
page, = render_pages(''' <table style="width: 1000px; border-spacing: 0 100px; font: 20px/1em serif; margin: 3px; table-layout: fixed"> <tr> <td rowspan=0 style="height: 420px; vertical-align: top"></td> <td>X<br>X<br>X</td> <td><table style="margin-to...
4 * border-spacing @assert_no_logs def test_table_column_width_3(): # Sum of columns width larger that the table width: # increase the table width page, = render_pages(''' <style> table { width: 1000px; border-spacing: 100px; table-layout: fixed } td { width: 60% } </style> ...
240
240
801
13
226
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_row_height_1
test_table_row_height_1
1,737
1,817
1,737
1,738
9e87f7c1d4ab44ea7a65231202e62f188dbd2b97
bigcode/the-stack
train
178e4d7a75e6764962432332
train
function
@assert_no_logs def test_table_column_width_3(): # Sum of columns width larger that the table width: # increase the table width page, = render_pages(''' <style> table { width: 1000px; border-spacing: 100px; table-layout: fixed } td { width: 60% } </style> <table> <t...
@assert_no_logs def test_table_column_width_3(): # Sum of columns width larger that the table width: # increase the table width
page, = render_pages(''' <style> table { width: 1000px; border-spacing: 100px; table-layout: fixed } td { width: 60% } </style> <table> <tr> <td> <td> </tr> </table> ''') html, = page.children body, = html.children wrapper, ...
assert row.children[2].width == 0 assert table.width == 1500 # 500 + 600 + 4 * border-spacing @assert_no_logs def test_table_column_width_3(): # Sum of columns width larger that the table width: # increase the table width
66
66
222
32
33
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_column_width_3
test_table_column_width_3
1,708
1,734
1,708
1,711
059ab6ce007b6109f3f941228e4aa9e9d6ce15b3
bigcode/the-stack
train
2891fea0f668b6d684fc99a9
train
function
@assert_no_logs def test_table_vertical_align(): assert_pixels('table_vertical_align', 28, 10, ''' rrrrrrrrrrrrrrrrrrrrrrrrrrrr rBBBBBBBBBBBBBBBBBBBBBBBBBBr rBrBB_BB_BB_BB_BBrrBBrrBB_Br rBrBB_BB_BBrBBrBBrrBBrrBBrBr rB_BBrBB_BBrBBrBBrrBBrrBBrBr rB_BBrBB_BB_BB_BBrrBBrrB...
@assert_no_logs def test_table_vertical_align():
assert_pixels('table_vertical_align', 28, 10, ''' rrrrrrrrrrrrrrrrrrrrrrrrrrrr rBBBBBBBBBBBBBBBBBBBBBBBBBBr rBrBB_BB_BB_BB_BBrrBBrrBB_Br rBrBB_BB_BBrBBrBBrrBBrrBBrBr rB_BBrBB_BBrBBrBBrrBBrrBBrBr rB_BBrBB_BB_BB_BBrrBBrrBB_Br rB_BB_BBrBB_BB_BB__BB__BB_Br ...
/WeasyPrint/issues/ page, = render_pages(''' <style> @font-face { src: url(AHEM____.TTF); font-family: ahem } </style> <table style="border-spacing: 0; font-family: ahem; line-height: 20px"> <tr><td>Table</td><td rowspan="2"></td></tr> <tr></tr> </table> ''') ...
193
193
645
11
181
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_vertical_align
test_table_vertical_align
1,865
1,927
1,865
1,866
1c94ddf65d85dbbe21e187b356767772b08b67ec
bigcode/the-stack
train
325cdfec6316cc077555f636
train
function
@assert_no_logs def test_table_page_break_after(): page1, page2, page3, page4, page5, page6 = render_pages(''' <style> @page { size: 1000px } h1 { height: 30px} td { height: 40px } table { table-layout: fixed; width: 100% } </style> <h1>Dummy title</h1> <table...
@assert_no_logs def test_table_page_break_after():
page1, page2, page3, page4, page5, page6 = render_pages(''' <style> @page { size: 1000px } h1 { height: 30px} td { height: 40px } table { table-layout: fixed; width: 100% } </style> <h1>Dummy title</h1> <table> <tbody> <tr><td>row 1</td></tr...
table, = table_wrapper.children for group in table.children: assert group.children, 'found an empty table group' rows = [] for row in group.children: cell, = row.children line, = cell.children text, ...
201
201
673
12
188
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_break_after
test_table_page_break_after
2,192
2,269
2,192
2,193
d189ecaa0e311e47adaa4d1df4036ae9bd2e7af3
bigcode/the-stack
train
e53d2808389a17ac84af6596
train
function
@assert_no_logs def test_layout_table_fixed_1(): page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; margin: 5px"> <colgroup> <col style="width: 20px" /> </colgroup> <tr> <td></td> <td style="width: 40px">a</td> </tr> ...
@assert_no_logs def test_layout_table_fixed_1():
page, = render_pages(''' <table style="table-layout: fixed; border-spacing: 10px; margin: 5px"> <colgroup> <col style="width: 20px" /> </colgroup> <tr> <td></td> <td style="width: 40px">a</td> </tr> </table> ''') html, = page.children...
> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, td_2 = row.children @assert_no_logs def test_layout_table_fixed_1():
79
79
266
13
65
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_fixed_1
test_layout_table_fixed_1
87
113
87
88
ef623564037ff8c9b88a7b1becbd6111b2015ed4
bigcode/the-stack
train
88adb89094aeb5113e7ed266
train
function
@assert_no_logs def test_layout_table_auto_43(): # Cell width as percentage on colspan cell in auto-width table page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%" colspan=2>a a a...
@assert_no_logs def test_layout_table_auto_43(): # Cell width as percentage on colspan cell in auto-width table
page, = render_pages(''' <div style="width: 100px"> <table> <tbody> <tr> <td>a a a a a a a a</td> <td style="width: 30%" colspan=2>a a a a a a a a</td> <td>a a a a a a a a</td> </tr> </tbody> </table> <...
_group.children td_1, td_2 = row.children assert td_1.width == 70 assert td_2.width == 30 assert table.width == 100 @assert_no_logs def test_layout_table_auto_43(): # Cell width as percentage on colspan cell in auto-width table
70
70
236
27
42
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_43
test_layout_table_auto_43
1,312
1,339
1,312
1,314
64577979e9f64663936b3605f466cfba673874f4
bigcode/the-stack
train
7c916017c69f9e7fda91f35f
train
function
@assert_no_logs def test_layout_table_auto_1(): page, = render_pages(''' <body style="width: 100px"> <table style="border-spacing: 10px; margin: auto"> <tr> <td><img src=pattern.png></td> <td><img src=pattern.png></td> </tr> </table> ''') html, = page.ch...
@assert_no_logs def test_layout_table_auto_1():
page, = render_pages(''' <body style="width: 100px"> <table style="border-spacing: 10px; margin: auto"> <tr> <td><img src=pattern.png></td> <td><img src=pattern.png></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapp...
35 assert td_2.width == 34 assert td_2.margin_width() == 60 # 34 + 2*10 + 5 + 1 assert table.width == 90 # 30 + 60 assert table.margin_width() == 100 # 90 + 2*5 (border) @assert_no_logs def test_layout_table_auto_1():
88
88
295
13
75
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_1
test_layout_table_auto_1
253
280
253
254
00bf5d48e4836fddc3a1444a159db3686c53348d
bigcode/the-stack
train
ef40d2b032bde151636b5205
train
function
@assert_no_logs def test_layout_table_auto_2(): page, = render_pages(''' <body style="width: 50px"> <table style="border-spacing: 1px; margin: 10%"> <tr> <td style="border: 3px solid black"><img src=pattern.png></td> <td style="border: 3px solid black"> <img src=p...
@assert_no_logs def test_layout_table_auto_2():
page, = render_pages(''' <body style="width: 50px"> <table style="border-spacing: 1px; margin: 10%"> <tr> <td style="border: 3px solid black"><img src=pattern.png></td> <td style="border: 3px solid black"> <img src=pattern.png><img src=pattern.png> </td>...
1.position_x == 41 # 31 + spacing assert td_1.width == 4 assert td_2.position_x == 55 # 31 + 4 + spacing assert td_2.width == 4 assert table.width == 38 # 3 * spacing + 2 * 4 @assert_no_logs def test_layout_table_auto_2():
86
86
288
13
72
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_2
test_layout_table_auto_2
283
309
283
284
12700afbd82f3a9b6408ba077bb288c47798221c
bigcode/the-stack
train
3b39d61b15a874ecb255e781
train
function
@assert_no_logs def test_layout_table_auto_28(): # Table with a cell larger than the table's width and max-width page, = render_pages(''' <table style="width: 300px; max-width: 350px"> <td style="width: 400px"></td> </table> ''')
@assert_no_logs def test_layout_table_auto_28(): # Table with a cell larger than the table's width and max-width
page, = render_pages(''' <table style="width: 300px; max-width: 350px"> <td style="width: 400px"></td> </table> ''')
render_pages(''' <table style="width: 300px"> <td style="width: 400px"></td> </table> ''') @assert_no_logs def test_layout_table_auto_28(): # Table with a cell larger than the table's width and max-width
64
64
75
29
35
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_28
test_layout_table_auto_28
1,062
1,069
1,062
1,064
16d11d26379a74c8b548b95eabe207e7b273e677
bigcode/the-stack
train
dbf8cfbc3f186da23227efac
train
function
@assert_no_logs def test_implicit_width_table_td_percent(): page, = render_pages(''' <table> <tr> <td style="width:25%"></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wr...
@assert_no_logs def test_implicit_width_table_td_percent():
page, = render_pages(''' <table> <tr> <td style="width:25%"></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children row, = ro...
body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, td_2 = row.children @assert_no_logs def test_implicit_width_table_td_percent():
64
64
117
14
49
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_implicit_width_table_td_percent
test_implicit_width_table_td_percent
68
84
68
69
a2c0a41b8385a7d1e0dd2d9bffe08c2bfe001e4b
bigcode/the-stack
train
cd3d26c2c8d183d8b0d8a670
train
function
@assert_no_logs def test_table_column_width_2(): page, = render_pages(''' <style> table { width: 1000px; border-spacing: 100px; table-layout: fixed } </style> <table> <tr> <td style="width: 50%"> <td style="width: 60%"> <td> </tr> </table...
@assert_no_logs def test_table_column_width_2():
page, = render_pages(''' <style> table { width: 1000px; border-spacing: 100px; table-layout: fixed } </style> <table> <tr> <td style="width: 50%"> <td style="width: 60%"> <td> </tr> </table> ''') html, = page.children body, = ...
0 - 3*border-spacing assert cells[2][1].width == 8678 # 8700 - borders - padding assert cells[2][1].colspan == 3 # truncated to grid width @assert_no_logs def test_table_column_width_2():
64
64
196
13
50
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_column_width_2
test_table_column_width_2
1,682
1,705
1,682
1,683
8894d5bd6fa1d1e4a427e06a819a359b5709b52d
bigcode/the-stack
train
2d73c81bdca92b7d3f2e7057
train
function
@assert_no_logs def test_layout_table_auto_24(): # Column width as percentage and cell width in pixels page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 70%" /> <col /> </colgroup> <tbody> <tr> <td>a</td> ...
@assert_no_logs def test_layout_table_auto_24(): # Column width as percentage and cell width in pixels
page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 70%" /> <col /> </colgroup> <tbody> <tr> <td>a</td> <td style="width: 60px">abc</td> </tr> </tbody> </table> ''') ht...
td_1, td_2 = row.children assert td_1.width == 100 assert td_2.width == 100 assert table.width == 200 @assert_no_logs def test_layout_table_auto_24(): # Column width as percentage and cell width in pixels
64
64
200
25
38
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_24
test_layout_table_auto_24
980
1,006
980
982
38933467f1f9513ef9f280204ac48b39d5595c9e
bigcode/the-stack
train
0dbb4231e0b8d46c8d6805b2
train
function
@pytest.mark.xfail @assert_no_logs def test_layout_table_auto_49(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685 # See TODO in table_layout.group_layout page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-famil...
@pytest.mark.xfail @assert_no_logs def test_layout_table_auto_49(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685 # See TODO in table_layout.group_layout
page, = render_pages(''' <style>@font-face { src: url(AHEM____.TTF); font-family: ahem }</style> <table style="font-family: ahem; border-spacing: 100px"> <tr> <td colspan=5>aaa</td> </tr> </table> ''') html, = page.children body, = html.children table_wrap...
assert td.width == 48 # 3 * font-size @pytest.mark.xfail @assert_no_logs def test_layout_table_auto_49(): # Related to: # https://github.com/Kozea/WeasyPrint/issues/685 # See TODO in table_layout.group_layout
64
64
196
50
13
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_49
test_layout_table_auto_49
1,490
1,511
1,490
1,495
fdd82c92052cf458407fe2b0891994a5bb657886
bigcode/the-stack
train
152176f206ee4f9ff4f009fd
train
function
@assert_no_logs def test_layout_table_auto_23(): # Wrong column group width page, = render_pages(''' <table style="width: 200px"> <colgroup style="width: 20%"> <col /> <col /> </colgroup> <tbody> <tr> <td>a</td> <td>a</td> ...
@assert_no_logs def test_layout_table_auto_23(): # Wrong column group width
page, = render_pages(''' <table style="width: 200px"> <colgroup style="width: 20%"> <col /> <col /> </colgroup> <tbody> <tr> <td>a</td> <td>a</td> </tr> </tbody> </table> ''') html, = page.children ...
1.width == 50 assert td_2.width == 50 assert td_3.width == 200 assert td_4.width == 200 assert table.width == 500 @assert_no_logs def test_layout_table_auto_23(): # Wrong column group width
64
64
186
20
43
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_23
test_layout_table_auto_23
951
977
951
953
37dbc9f10ceb344a48ed661926adf38cebfc7d44
bigcode/the-stack
train
9d574360fc3cb573b84578cc
train
function
@assert_no_logs def test_layout_table_auto_12(): page, = render_pages(''' <table style="border-spacing: 10px"> <tr> <td style="width: 10px"></td> <td colspan="3"></td> </tr> <tr> <td colspan="2" style="width: 32px"></td> <td style="width: 8px"></...
@assert_no_logs def test_layout_table_auto_12():
page, = render_pages(''' <table style="border-spacing: 10px"> <tr> <td style="width: 10px"></td> <td colspan="3"></td> </tr> <tr> <td colspan="2" style="width: 32px"></td> <td style="width: 8px"></td> <td style="width: 8px"></td> ...
28 # 38 - 10 assert td_21.width == 22 # fixed assert td_22.width == 8 # fixed assert td_23.width == 8 # fixed assert td_31.width == 10 # same as first line assert td_32.width == 12 # 22 - 10 assert td_33.width == 16 # 8 + 8 from second line assert table.width == 38 @assert_no_logs de...
123
123
412
13
109
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_12
test_layout_table_auto_12
614
653
614
615
a89051baecacf9c559b15e960cc2a60302398baf
bigcode/the-stack
train
40899a0f2ac1050b71ed1d45
train
function
@assert_no_logs def test_layout_table_auto_18(): # Column widths as percentage page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 70%" /> <col style="width: 30%" /> </colgroup> <tbody> <tr> <td>a</td> ...
@assert_no_logs def test_layout_table_auto_18(): # Column widths as percentage
page, = render_pages(''' <table style="width: 200px"> <colgroup> <col style="width: 70%" /> <col style="width: 30%" /> </colgroup> <tbody> <tr> <td>a</td> <td>abc</td> </tr> </tbody> </table> ''') htm...
10 + 5 + 1 assert table.width == 90 # 30 + 60 assert table.margin_width() == 100 # 90 + 2*5 (border) @assert_no_logs def test_layout_table_auto_18(): # Column widths as percentage
64
64
195
20
44
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_18
test_layout_table_auto_18
784
810
784
786
4c9afc7edb4d30e16b54793df7f159599ed4ace0
bigcode/the-stack
train
4b4cd0da7a13277a25928fde
train
function
@assert_no_logs @pytest.mark.parametrize('html, rows', ( (''' <style> @page { size: 100px } table { table-layout: fixed; width: 100% } tr { height: 26px } </style> <table> <tbody> <tr><td>row 0</td></tr> <tr><td>row 1</td></tr> <tr styl...
@assert_no_logs @pytest.mark.parametrize('html, rows', ( (''' <style> @page { size: 100px } table { table-layout: fixed; width: 100% } tr { height: 26px } </style> <table> <tbody> <tr><td>row 0</td></tr> <tr><td>row 1</td></tr> <tr styl...
pages = render_pages(html) assert len(pages) == len(rows) rows_per_page = [] for page in pages: html, = page.children body, = html.children if body.children[0].element_tag == 'p': rows_per_page.append(len(body.children)) continue else: ...
@assert_no_logs @pytest.mark.parametrize('html, rows', ( (''' <style> @page { size: 100px } table { table-layout: fixed; width: 100% } tr { height: 26px } </style> <table> <tbody> <tr><td>row 0</td></tr> <tr><td>row 1</td></tr> <tr styl...
1,763
256
1,900
1,763
0
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_page_break_avoid
test_table_page_break_avoid
2,353
2,573
2,353
2,554
f2275a8b28e714d86f6cdcdb2c38017ad1d2c927
bigcode/the-stack
train
0614500c0db08e5caeec2742
train
function
@assert_no_logs def test_layout_table_auto_33(): # Div with auto width containing a table with a min-width page, = render_pages(''' <div style="float: left"> <table style="min-width: 400px; margin: 100px"> <td></td> </table> </div> ''') html, = page.children bod...
@assert_no_logs def test_layout_table_auto_33(): # Div with auto width containing a table with a min-width
page, = render_pages(''' <div style="float: left"> <table style="min-width: 400px; margin: 100px"> <td></td> </table> </div> ''') html, = page.children body, = html.children div, = body.children table_wrapper, = div.children assert div.margin_width() == ...
body, = html.children table_wrapper, = body.children assert table_wrapper.margin_width() == 600 # 400 + 2 * 100 @assert_no_logs def test_layout_table_auto_33(): # Div with auto width containing a table with a min-width
64
64
149
27
36
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_33
test_layout_table_auto_33
1,118
1,133
1,118
1,120
ff956b751ca36fe9c739ef521da3762ed3b87cb9
bigcode/the-stack
train
a6a7f80cd1c57b9777468e1d
train
function
@assert_no_logs def test_layout_table_auto_9(): page, = render_pages(''' <table style="border-spacing: 10px; width: 110px; margin: 5px"> <tr> <td style="width: 60px"></td> <td></td> </tr> <tr> <td style="width: 50px"></td> <td style="width: 30px"...
@assert_no_logs def test_layout_table_auto_9():
page, = render_pages(''' <table style="border-spacing: 10px; width: 110px; margin: 5px"> <tr> <td style="width: 60px"></td> <td></td> </tr> <tr> <td style="width: 50px"></td> <td style="width: 30px"></td> </tr> </table> ''') ...
0 + margin-left assert td_1.position_x == 15 # 5 + border-spacing assert td_1.width == 20 # fixed assert td_2.position_x == 45 # 15 + 20 + border-spacing assert td_2.width == 70 # 120 - 3 * border-spacing - 20 assert table.width == 120 @assert_no_logs def test_layout_table_auto_9():
102
102
340
13
88
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_9
test_layout_table_auto_9
507
539
507
508
550d78f596c72e00f30e7527f25c07274fbd36d0
bigcode/the-stack
train
3af224dbfceb1b0448ec6632
train
function
@assert_no_logs def test_layout_table_auto_3(): page, = render_pages(''' <table style="border-spacing: 1px; margin: 5px; font-size: 0"> <tr> <td></td> <td><img src=pattern.png><img src=pattern.png></td> </tr> <tr> <td> <img src=pattern.png> ...
@assert_no_logs def test_layout_table_auto_3():
page, = render_pages(''' <table style="border-spacing: 1px; margin: 5px; font-size: 0"> <tr> <td></td> <td><img src=pattern.png><img src=pattern.png></td> </tr> <tr> <td> <img src=pattern.png> <img src=pattern.png> <img ...
assert td_1.position_x == 6 # 5 + border-spacing assert td_1.width == 4 assert td_2.position_x == 17 # 6 + 4 + spacing + 2 * border assert td_2.width == 8 assert table.width == 27 # 3 * spacing + 4 + 8 + 4 * border @assert_no_logs def test_layout_table_auto_3():
100
100
336
13
86
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_3
test_layout_table_auto_3
312
344
312
313
2306f05e311ef229467ac034180ffb4676fc4c79
bigcode/the-stack
train
6fee56d42916e96a87b6a944
train
function
@assert_no_logs def test_layout_table_auto_42(): # Cell width as percentage in auto-width table page, = render_pages(''' <table> <tbody> <tr> <td style="width: 70px">a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> </tr> <...
@assert_no_logs def test_layout_table_auto_42(): # Cell width as percentage in auto-width table
page, = render_pages(''' <table> <tbody> <tr> <td style="width: 70px">a a a a a a a a</td> <td style="width: 30%">a a a a a a a a</td> </tr> </tbody> </table> ''') html, = page.children body, = html.children table_wrappe...
td_1, td_2 = row.children assert td_1.width == 70 assert td_2.width == 30 assert table.width == 100 @assert_no_logs def test_layout_table_auto_42(): # Cell width as percentage in auto-width table
64
64
188
24
39
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_42
test_layout_table_auto_42
1,287
1,309
1,287
1,289
b92c561ac9f62297a5b9fe3260bb64f36d40e666
bigcode/the-stack
train
18878975ad9722124c47a750
train
function
@assert_no_logs def test_layout_table_auto_14(): page, = render_pages(''' <table style="width: 20px"> <col /> <col /> <tr> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table...
@assert_no_logs def test_layout_table_auto_14():
page, = render_pages(''' <table style="width: 20px"> <col /> <col /> <tr> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group, = table.children...
row.children assert td_1.width == 20 # 2 / 3 * 30 assert td_2.width == 10 # 1 / 3 * 30 assert table.width == 30 @assert_no_logs def test_layout_table_auto_14():
64
64
134
13
50
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_14
test_layout_table_auto_14
679
698
679
680
24eba19752b492b6ed2e1372019cf98154286556
bigcode/the-stack
train
7afac63415c085be82bc884f
train
function
@assert_no_logs def test_layout_table_auto_21(): # Fixed-width table with column group with widths as percentages and pixels page, = render_pages(''' <table style="width: 500px"> <colgroup style="width: 100px"> <col /> <col /> </colgroup> <colgroup style="width:...
@assert_no_logs def test_layout_table_auto_21(): # Fixed-width table with column group with widths as percentages and pixels
page, = render_pages(''' <table style="width: 500px"> <colgroup style="width: 100px"> <col /> <col /> </colgroup> <colgroup style="width: 30%"> <col /> <col /> </colgroup> <tbody> <tr> <td>a</td> ...
, td_2, td_3 = row.children assert td_1.width == 50 assert td_2.width == 30 assert td_3.width == 120 assert table.width == 200 @assert_no_logs def test_layout_table_auto_21(): # Fixed-width table with column group with widths as percentages and pixels
78
78
263
28
49
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_21
test_layout_table_auto_21
877
911
877
879
3102cefa3d76a9d74a3a93ec18b8429e727f385a
bigcode/the-stack
train
aca689ac20a8db5029657e9f
train
function
@assert_no_logs def test_layout_table_auto_16(): # Absolute table page, = render_pages(''' <table style="width: 30px; position: absolute"> <tr> <td colspan=2></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrap...
@assert_no_logs def test_layout_table_auto_16(): # Absolute table
page, = render_pages(''' <table style="width: 30px; position: absolute"> <tr> <td colspan=2></td> <td></td> </tr> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children row_group...
table_wrapper.children column_group, = table.column_groups column_1, column_2 = column_group.children assert column_1.width == 0 assert column_2.width == 0 @assert_no_logs def test_layout_table_auto_16(): # Absolute table
64
64
177
18
45
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_16
test_layout_table_auto_16
719
739
719
721
23a14227de8d21c1a0fc4864bfc7024afc22d0cf
bigcode/the-stack
train
c5d8c495b6fff1b1c56c55e4
train
function
@assert_no_logs def test_layout_table_auto_15(): page, = render_pages(''' <table style="width: 20px"> <col /> <col /> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children column_group, = table.col...
@assert_no_logs def test_layout_table_auto_15():
page, = render_pages(''' <table style="width: 20px"> <col /> <col /> </table> ''') html, = page.children body, = html.children table_wrapper, = body.children table, = table_wrapper.children column_group, = table.column_groups column_1, column_2 = column_group....
table, = table_wrapper.children row_group, = table.children row, = row_group.children td_1, = row.children assert td_1.width == 20 assert table.width == 20 @assert_no_logs def test_layout_table_auto_15():
64
64
119
13
50
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_15
test_layout_table_auto_15
701
716
701
702
4e248ab400f11b7f9a9006d65ca0021c1d61b540
bigcode/the-stack
train
8de332962b664d5933a65e32
train
function
@assert_no_logs def test_layout_table_auto_4(): page, = render_pages(''' <table style="border-spacing: 1px; margin: 5px"> <tr> <td style="border: 1px solid black"><img src=pattern.png></td> <td style="border: 2px solid black; padding: 1px"> <img src=pattern.png> ...
@assert_no_logs def test_layout_table_auto_4():
page, = render_pages(''' <table style="border-spacing: 1px; margin: 5px"> <tr> <td style="border: 1px solid black"><img src=pattern.png></td> <td style="border: 2px solid black; padding: 1px"> <img src=pattern.png> </td> </tr> <tr> <t...
# 0 + margin-left assert td_11.position_x == td_21.position_x == 6 # 5 + spacing assert td_11.width == td_21.width == 12 assert td_12.position_x == td_22.position_x == 19 # 6 + 12 + spacing assert td_12.width == td_22.width == 8 assert table.width == 23 # 3 * spacing + 12 + 8 @assert_no_logs de...
120
120
401
13
106
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_layout_table_auto_4
test_layout_table_auto_4
347
379
347
348
7180b373aa71a18038532d5cda5479d80ffb8de4
bigcode/the-stack
train
f222fc22dd2378607da24653
train
function
@assert_no_logs def test_table_column_width_1(): source = ''' <style> body { width: 20000px; margin: 0 } table { width: 10000px; margin: 0 auto; border-spacing: 100px 0; table-layout: fixed } td { border: 10px solid; padding: 1px } </style> <tabl...
@assert_no_logs def test_table_column_width_1():
source = ''' <style> body { width: 20000px; margin: 0 } table { width: 10000px; margin: 0 auto; border-spacing: 100px 0; table-layout: fixed } td { border: 10px solid; padding: 1px } </style> <table> <col style="width: 10%"> <tr> ...
-size: 1px } td, th { border: 10px solid } </style> <table style=""> <col style="width: 25%%"></col> <col></col> <tr> <th>الاسم</th> <th>العائلة</th> </tr> <tr> <td>محمد يوسف</td> <td>29</td> </tr> </table>...
256
256
1,159
13
242
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_column_width_1
test_table_column_width_1
1,583
1,679
1,583
1,584
365e55d1471d57d2415b16a3bf87cef139425383
bigcode/the-stack
train
bf4b90a036347d682c7bca9d
train
function
@assert_no_logs def test_table_wrapper(): page, = render_pages(''' <style> @page { size: 1000px } table { width: 600px; height: 500px; table-layout: fixed; padding: 1px; border: 10px solid; margin: 100px; } </style> <table></table> ''') html, = page.childr...
@assert_no_logs def test_table_wrapper():
page, = render_pages(''' <style> @page { size: 1000px } table { width: 600px; height: 500px; table-layout: fixed; padding: 1px; border: 10px solid; margin: 100px; } </style> <table></table> ''') html, = page.children body, = html.children wrapper, ...
2em; padding-bottom: 2px !important"> o o </td> <!-- Test padding-top, auto height --> <td style="vertical-align: top; padding-top: 1em !important"> o o </td> </tr> </table> ''') # noqa @assert_no_logs def test_table_wrapper():
82
82
276
10
71
rfiedorowicz/WeasyPrint
tests/test_layout/test_table.py
Python
test_table_wrapper
test_table_wrapper
1,930
1,954
1,930
1,931
c160b6444b0fb60d220150fd778106e094379641
bigcode/the-stack
train