Best Python code snippet using lisa_python
swea_4014.py
Source:swea_4014.py  
1T = int(input())2for tc in range(1, T+1):3    N, length = map(int, input().split())4    board = [list(map(int, input().split())) for _ in range(N)]5    install_number = 06    #ê°ë¡7    for i in range(N):8        one_line = board[i]9        can_install = True10        installing = False11        cnt = 112        for j in range(N-1):13            if one_line[j] == one_line[j+1]:14                cnt += 115                if installing and (cnt >= length):16                    installing = False17                    cnt = 018                if (j == N - 2) and installing:19                    can_install = False20            elif one_line[j] == one_line[j+1]+1:21                if installing:22                    can_install = False23                    break24                installing = True25                cnt = 126                if N - j <= length:27                    can_install = False28            elif one_line[j]+1 == one_line[j+1]:29                if cnt >= length:30                    cnt = 131                else:32                    can_install = False33                    break34            else:35                can_install = False36                break37        if can_install:38            install_number += 139    #ì¸ë¡ë¦¬ì¤í¸ ìë¡ ìì±40    row_list = [[] for _ in range(N)]41    for i in range(N):42        for j in range(N):43            row_list[i].append(board[j][i])44    for i in range(N):45        row_line = row_list[i]46        can_install = True47        installing = False48        row_cnt = 149        for j in range(N - 1):50            if row_line[j] == row_line[j + 1]:51                row_cnt += 152                if installing and row_cnt >= length:53                    installing = False54                    row_cnt = 055                if j == N - 2 and installing:56                    can_install = False57            elif row_line[j] == row_line[j + 1] + 1:58                if installing:59                    can_install = False60                    break61                installing = True62                row_cnt = 163                if j == N - 2 and installing:64                    can_install = False65            elif row_line[j] + 1 == row_line[j + 1]:66                if row_cnt >= length:67                    row_cnt = 168                else:69                    can_install = False70                    break71            else:72                can_install = False73                break74        if can_install:75            install_number += 1...test_core.py
Source:test_core.py  
1"""Configuration Test Suite: Core repository."""2# pylint: disable=missing-docstring3from custom_components.hacs.helpers.classes.repository import HacsRepository4def test_hacs_repository_core_mostly_defaults():5    repository = HacsRepository()6    repository.data.full_name = "developer/repository"7    repository.data.full_name_lower = "developer/repository"8    repository.data.default_branch = "master"9    repository.data.description = "Awesome GitHub repository"10    assert repository.display_name == "Repository"11    assert repository.custom12    assert repository.display_status == "new"13    assert repository.display_status_description == "This is a newly added repository."14    assert repository.main_action == "INSTALL"15    assert repository.display_version_or_commit == "commit"16    assert repository.display_available_version == ""17    assert repository.display_installed_version == ""18    assert repository.can_install19    assert not repository.pending_upgrade20def test_hacs_repository_core_can_install_legacy():21    repository = HacsRepository()22    repository.hacs.system.ha_version = "1.0.0"23    repository.data.releases = True24    repository.data.homeassistant = "1.1.0"25    assert not repository.can_install26    repository.data.homeassistant = "1.0.0"27    assert repository.can_install28    repository.data.homeassistant = "0.1.0"29    assert repository.can_install30def test_hacs_repository_core_can_install_manifest():31    repository = HacsRepository()32    repository.hacs.system.ha_version = "1.0.0"33    repository.data.releases = True34    repository.data.homeassistant = "1.1.0"35    assert not repository.can_install36    repository.data.homeassistant = "1.0.0"37    assert repository.can_install38    repository.data.homeassistant = "0.1.0"...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
