Best Python code snippet using localstack_python
Conformance_Expressions.js
Source:Conformance_Expressions.js  
...264expressionList[expressionList.length] = "*[substring-before('employeeId', 'Id')]";265expressionList[expressionList.length] = "*[substring-after('employeeId', 'employee')]";266expressionList[expressionList.length] = "*[substring('employeeId', 4)]";267expressionList[expressionList.length] = "*[substring('employeeId', 4, 5)]";268expressionList[expressionList.length] = "*[string-length()=2]";269expressionList[expressionList.length] = "*[string-length(.)=string-length(normalize-space(.))]";270expressionList[expressionList.length] = "*[translate('bar', 'abc', 'ABC')='BAr']";271expressionList[expressionList.length] = "*[boolean(.)]";272expressionList[expressionList.length] = "*[not(boolean(.))]";273expressionList[expressionList.length] = "*[true()]";274expressionList[expressionList.length] = "*[false()]";275expressionList[expressionList.length] = "*[lang('en')]";276expressionList[expressionList.length] = "*[number()]";277expressionList[expressionList.length] = "*[number('4')]";278expressionList[expressionList.length] = "*[floor(.)]>0";279expressionList[expressionList.length] = "*[ceiling(.)]<1";280expressionList[expressionList.length] = "*[round(number(.))=0]<1";281for(var indexN66388 = 0;indexN66388 < expressionList.length; indexN66388++) {282      expression = expressionList[indexN66388];283      xpathexpression = evaluator.createExpression(expression,resolver);...test_distance.py
Source:test_distance.py  
1"""Test Home Assistant distance utility functions."""2import pytest3from homeassistant.const import (4    LENGTH_CENTIMETERS,5    LENGTH_FEET,6    LENGTH_INCHES,7    LENGTH_KILOMETERS,8    LENGTH_METERS,9    LENGTH_MILES,10    LENGTH_MILLIMETERS,11    LENGTH_YARD,12)13import homeassistant.util.distance as distance_util14INVALID_SYMBOL = "bob"15VALID_SYMBOL = LENGTH_KILOMETERS16def test_convert_same_unit():17    """Test conversion from any unit to same unit."""18    assert distance_util.convert(5, LENGTH_KILOMETERS, LENGTH_KILOMETERS) == 519    assert distance_util.convert(2, LENGTH_METERS, LENGTH_METERS) == 220    assert distance_util.convert(6, LENGTH_CENTIMETERS, LENGTH_CENTIMETERS) == 621    assert distance_util.convert(3, LENGTH_MILLIMETERS, LENGTH_MILLIMETERS) == 322    assert distance_util.convert(10, LENGTH_MILES, LENGTH_MILES) == 1023    assert distance_util.convert(9, LENGTH_YARD, LENGTH_YARD) == 924    assert distance_util.convert(8, LENGTH_FEET, LENGTH_FEET) == 825    assert distance_util.convert(7, LENGTH_INCHES, LENGTH_INCHES) == 726def test_convert_invalid_unit():27    """Test exception is thrown for invalid units."""28    with pytest.raises(ValueError):29        distance_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL)30    with pytest.raises(ValueError):31        distance_util.convert(5, VALID_SYMBOL, INVALID_SYMBOL)32def test_convert_nonnumeric_value():33    """Test exception is thrown for nonnumeric type."""34    with pytest.raises(TypeError):35        distance_util.convert("a", LENGTH_KILOMETERS, LENGTH_METERS)36def test_convert_from_miles():37    """Test conversion from miles to other units."""38    miles = 539    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_KILOMETERS) == 8.0467240    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_METERS) == 8046.7241    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_CENTIMETERS) == 804672.042    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_MILLIMETERS) == 8046720.043    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_YARD) == 8799.973459244    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_FEET) == 26400.000844845    assert distance_util.convert(miles, LENGTH_MILES, LENGTH_INCHES) == 316800.17107246def test_convert_from_yards():47    """Test conversion from yards to other units."""48    yards = 549    assert (50        distance_util.convert(yards, LENGTH_YARD, LENGTH_KILOMETERS)51        == 0.004572000000000000552    )53    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_METERS) == 4.57254    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_CENTIMETERS) == 457.255    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_MILLIMETERS) == 4572.056    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_MILES) == 0.00284090821257    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_FEET) == 15.0000004858    assert distance_util.convert(yards, LENGTH_YARD, LENGTH_INCHES) == 180.000097259def test_convert_from_feet():60    """Test conversion from feet to other units."""61    feet = 500062    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_KILOMETERS) == 1.52463    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_METERS) == 152464    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_CENTIMETERS) == 152400.065    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_MILLIMETERS) == 1524000.066    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_MILES) == 0.946969404000000167    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_YARD) == 1666.6616468    assert distance_util.convert(feet, LENGTH_FEET, LENGTH_INCHES) == 60000.03240000000469def test_convert_from_inches():70    """Test conversion from inches to other units."""71    inches = 500072    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_KILOMETERS) == 0.12773    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_METERS) == 127.074    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_CENTIMETERS) == 12700.075    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_MILLIMETERS) == 127000.076    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_MILES) == 0.07891411777    assert (78        distance_util.convert(inches, LENGTH_INCHES, LENGTH_YARD) == 138.8884699999999879    )80    assert distance_util.convert(inches, LENGTH_INCHES, LENGTH_FEET) == 416.6666881def test_convert_from_kilometers():82    """Test conversion from kilometers to other units."""83    km = 584    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_METERS) == 500085    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_CENTIMETERS) == 50000086    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_MILLIMETERS) == 500000087    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_MILES) == 3.10685588    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_YARD) == 5468.0589    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_FEET) == 16404.290    assert distance_util.convert(km, LENGTH_KILOMETERS, LENGTH_INCHES) == 196850.591def test_convert_from_meters():92    """Test conversion from meters to other units."""93    m = 500094    assert distance_util.convert(m, LENGTH_METERS, LENGTH_KILOMETERS) == 595    assert distance_util.convert(m, LENGTH_METERS, LENGTH_CENTIMETERS) == 50000096    assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILLIMETERS) == 500000097    assert distance_util.convert(m, LENGTH_METERS, LENGTH_MILES) == 3.10685598    assert distance_util.convert(m, LENGTH_METERS, LENGTH_YARD) == 5468.0599    assert distance_util.convert(m, LENGTH_METERS, LENGTH_FEET) == 16404.2100    assert distance_util.convert(m, LENGTH_METERS, LENGTH_INCHES) == 196850.5101def test_convert_from_centimeters():102    """Test conversion from centimeters to other units."""103    cm = 500000104    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_KILOMETERS) == 5105    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_METERS) == 5000106    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_MILLIMETERS) == 5000000107    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_MILES) == 3.106855108    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_YARD) == 5468.05109    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_FEET) == 16404.2110    assert distance_util.convert(cm, LENGTH_CENTIMETERS, LENGTH_INCHES) == 196850.5111def test_convert_from_millimeters():112    """Test conversion from millimeters to other units."""113    mm = 5000000114    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_KILOMETERS) == 5115    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_METERS) == 5000116    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_CENTIMETERS) == 500000117    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_MILES) == 3.106855118    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_YARD) == 5468.05119    assert distance_util.convert(mm, LENGTH_MILLIMETERS, LENGTH_FEET) == 16404.2...medicationRecord.py
Source:medicationRecord.py  
1from django.db import models2from django.conf import settings3import logging4# Get an instance of a logger5logger = logging.getLogger(__name__)6from ...utilities.base_model import BaseModel7class MedicationRecord(BaseModel):8    class Meta:9        # https://docs.djangoproject.com/en/1.10/ref/models/options/#db-table10        db_table = 'curation_medication_record'11    id = models.AutoField(primary_key=True)12    encounter_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, db_index=True, null=True,)13    medication_record_type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)14    action = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)15    administering_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)16    code = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)17    daw_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)18    days_supply = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)19    days_supply_derived = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)20    discontinue_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)21    dispense_quantity = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)22    documenting_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)23    documenting_prov_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)24    doses_per_day = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)25    doses_per_day_derived = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)26    end_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)27    expire_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)28    form = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)29    frequency = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)30    gpi = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)31    infusion_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)32    infusion_end_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)33    infusion_expiry_1_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)34    infusion_expiry_2_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)35    infusion_expiry_3_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)36    infusion_expiry_4_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)37    infusion_flag = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)38    infusion_patient_weight = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)39    infusion_patient_weight_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)40    infusion_planned_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)41    infusion_planned_dose_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)42    infusion_rate = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)43    infusion_rate_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)44    infusion_reason_for_adjustment = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)45    infusion_start_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)46    infusion_therapy_type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)47    infusion_volume_infused = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)48    infusion_volume_infused_unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)49    name = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)50    ndc = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)51    or_dispense = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)52    pharmacy_fill_number = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)53    pharmacy_prescription_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)54    prescribing_provider_id = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)55    prescription_fill_number = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)56    reason_for_discontinuation = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)57    reason_for_start = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)58    refills_authorized = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)59    refills_authorized_numeric = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)60    route_of_admin = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)61    rxnorm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)62    sig = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)63    start_dttm = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)64    status = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)65    strength = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)66    total_dose = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)67    type = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)68    unit = models.CharField(max_length=settings.STRING_MAX_DEFAULT_LENGTH, null=True,)69    def getMedicationRecordForEncounter(self, encounterid):70        query = '''SELECT * FROM {} WHERE encounter_id = '{}' '''.format('curation_medication_record', encounterid)71        logger.info('query: {}'.format(query))...function_length.js
Source:function_length.js  
1shouldBe("Array.prototype.toString.length","0");2shouldBe("Array.prototype.toLocaleString.length","0");3shouldBe("Array.prototype.concat.length","1");4shouldBe("Array.prototype.join.length","1");5shouldBe("Array.prototype.pop.length","0");6shouldBe("Array.prototype.push.length","1");7shouldBe("Array.prototype.reverse.length","0");8shouldBe("Array.prototype.shift.length","0");9shouldBe("Array.prototype.slice.length","2"); // 15.4.4.1010shouldBe("Array.prototype.sort.length","1");11shouldBe("Array.prototype.splice.length","2"); // 15.4.4.1212shouldBe("Array.prototype.unshift.length","1");13shouldBe("Boolean.prototype.toString.length","0");14shouldBe("Boolean.prototype.valueOf.length","0");15shouldBe("Date.prototype.toString.length","0");16shouldBe("Date.prototype.toUTCString.length","0");17shouldBe("Date.prototype.toDateString.length","0");18shouldBe("Date.prototype.toTimeString.length","0");19shouldBe("Date.prototype.toLocaleString.length","0");20shouldBe("Date.prototype.toLocaleDateString.length","0");21shouldBe("Date.prototype.toLocaleTimeString.length","0");22shouldBe("Date.prototype.valueOf.length","0");23shouldBe("Date.prototype.getTime.length","0");24shouldBe("Date.prototype.getFullYear.length","0");25shouldBe("Date.prototype.getUTCFullYear.length","0");26shouldBe("Date.prototype.toGMTString.length","0");27shouldBe("Date.prototype.getMonth.length","0");28shouldBe("Date.prototype.getUTCMonth.length","0");29shouldBe("Date.prototype.getDate.length","0");30shouldBe("Date.prototype.getUTCDate.length","0");31shouldBe("Date.prototype.getDay.length","0");32shouldBe("Date.prototype.getUTCDay.length","0");33shouldBe("Date.prototype.getHours.length","0");34shouldBe("Date.prototype.getUTCHours.length","0");35shouldBe("Date.prototype.getMinutes.length","0");36shouldBe("Date.prototype.getUTCMinutes.length","0");37shouldBe("Date.prototype.getSeconds.length","0");38shouldBe("Date.prototype.getUTCSeconds.length","0");39shouldBe("Date.prototype.getMilliseconds.length","0");40shouldBe("Date.prototype.getUTCMilliseconds.length","0");41shouldBe("Date.prototype.getTimezoneOffset.length","0");42shouldBe("Date.prototype.setTime.length","1");43shouldBe("Date.prototype.setMilliseconds.length","1");44shouldBe("Date.prototype.setUTCMilliseconds.length","1");45shouldBe("Date.prototype.setSeconds.length","2");46shouldBe("Date.prototype.setUTCSeconds.length","2");47shouldBe("Date.prototype.setMinutes.length","3");48shouldBe("Date.prototype.setUTCMinutes.length","3");49shouldBe("Date.prototype.setHours.length","4");50shouldBe("Date.prototype.setUTCHours.length","4");51shouldBe("Date.prototype.setDate.length","1");52shouldBe("Date.prototype.setUTCDate.length","1");53shouldBe("Date.prototype.setMonth.length","2");54shouldBe("Date.prototype.setUTCMonth.length","2");55shouldBe("Date.prototype.setFullYear.length","3");56shouldBe("Date.prototype.setUTCFullYear.length","3");57shouldBe("Date.prototype.setYear.length","1");58shouldBe("Date.prototype.getYear.length","0");59shouldBe("Date.prototype.toGMTString.length","0");60shouldBe("Error.prototype.toString.length","0");61shouldBe("eval.length","1");62shouldBe("parseInt.length","2");63shouldBe("parseFloat.length","1");64shouldBe("isNaN.length","1");65shouldBe("isFinite.length","1");66shouldBe("escape.length","1");67shouldBe("unescape.length","1");68shouldBe("Math.abs.length","1");69shouldBe("Math.acos.length","1");70shouldBe("Math.asin.length","1");71shouldBe("Math.atan.length","1");72shouldBe("Math.atan2.length","2");73shouldBe("Math.ceil.length","1");74shouldBe("Math.cos.length","1");75shouldBe("Math.exp.length","1");76shouldBe("Math.floor.length","1");77shouldBe("Math.log.length","1");78shouldBe("Math.max.length","2");79shouldBe("Math.min.length","2");80shouldBe("Math.pow.length","2");81shouldBe("Math.random.length","0");82shouldBe("Math.round.length","1");83shouldBe("Math.sin.length","1");84shouldBe("Math.sqrt.length","1");85shouldBe("Math.tan.length","1");86shouldBe("Object.prototype.toString.length","0");87shouldBe("Object.prototype.valueOf.length","0");88shouldBe("RegExp.prototype.exec.length","0");89shouldBe("RegExp.prototype.test.length","0");90shouldBe("RegExp.prototype.toString.length","0");91shouldBe("String.fromCharCode.length","1");92shouldBe("String.prototype.concat.length","1");93shouldBe("String.prototype.toString.length","0");94shouldBe("String.prototype.valueOf.length","0");95shouldBe("String.prototype.charAt.length","1");96shouldBe("String.prototype.charCodeAt.length","1");97shouldBe("String.prototype.indexOf.length","1");98shouldBe("String.prototype.lastIndexOf.length","1");99shouldBe("String.prototype.match.length","1");100shouldBe("String.prototype.replace.length","2");101shouldBe("String.prototype.search.length","1");102shouldBe("String.prototype.slice.length","2"); // 15.5.4.13103shouldBe("String.prototype.split.length","2"); // 15.5.4.14104shouldBe("String.prototype.substr.length","2");105shouldBe("String.prototype.substring.length","2");106shouldBe("String.prototype.toLowerCase.length","0");107shouldBe("String.prototype.toUpperCase.length","0");108shouldBe("String.prototype.big.length","0");109shouldBe("String.prototype.small.length","0");110shouldBe("String.prototype.blink.length","0");111shouldBe("String.prototype.bold.length","0");112shouldBe("String.prototype.fixed.length","0");113shouldBe("String.prototype.italics.length","0");114shouldBe("String.prototype.strike.length","0");115shouldBe("String.prototype.sub.length","0");116shouldBe("String.prototype.sup.length","0");117shouldBe("String.prototype.fontcolor.length","1");118shouldBe("String.prototype.fontsize.length","1");119shouldBe("String.prototype.anchor.length","1");120shouldBe("String.prototype.link.length","1");121shouldBe("Number.prototype.toString.length", "1");122shouldBe("Number.prototype.valueOf.length", "0");123shouldBe("Number.prototype.toFixed.length", "1");...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!!
