Best Python code snippet using slash
netcdf.py
Source:netcdf.py  
...3023    fWkt = fgeo.ExportToWkt()3024    fnam = feat.GetFieldAsString("NAMES")3025    assert(fWkt == "MULTIPOINT (7 -2 1,4 3 2,8 -8 3)")3026    assert(fnam == "site2")3027def test_multiline_write():3028    if gdaltest.netcdf_drv is None:3029        pytest.skip()3030    src = gdal.OpenEx("data/netcdf-sg/write-tests/multiline_write_test.json", gdal.OF_VECTOR) 3031    assert(src is not None)3032    assert(src.GetLayerCount() == 1)3033    gdal.VectorTranslate("tmp/multiline_write_test.nc", src, format="netCDF");3034    nc_tsrc = ogr.Open("tmp/multiline_write_test.nc")3035    assert(src is not None)3036    # Test layer properties3037    layer = nc_tsrc.GetLayerByName("streams")3038    assert(layer is not None)3039    assert(layer.GetFeatureCount() == 3)3040    # Test each feature manually3041    feat = layer.GetNextFeature();...geojson_tests.py
Source:geojson_tests.py  
...140        s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806")141        ans = """{ "properties": {}, "bbox": [100.0, 0.0, 101.0, 1.0], "geometry": { "type": "Polygon", "coordinates": [ [ [ 100.0, 0.0 ], [ 101.0, 0.0 ], [ 101.0, 1.0 ], [ 100.0, 1.0 ], [ 100.0, 0.0 ] ] ] }, "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "type": "Feature" }"""142        self.verifyJSON(s, ans)143        return144    def test_multiline_write(self):145        p = Multiline([[(100, 0), (101, 1)], [(102, 2), (103, 3)]], crs=LonLatWGS84)146        s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806")147        ans = """{"type": "Feature", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "properties": {}, "bbox": [100.0, 0.0, 103.0, 3.0], "geometry" : { "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] } }"""148        self.verifyJSON(s, ans)149    def test_multipolygon_write(self):150        p = Multipolygon([[[(102, 2), (103, 2), (103, 3), (102, 3)]],151                          [[(100, 0), (101, 0), (101, 1), (100, 1)],152                           [(100.2, 0.2), (100.8, 0.2), (100.8, 0.8), (100.2, 0.8)]]],153                          crs=LonLatWGS84)154        s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806")155        ans = """{"type": "Feature", "properties": {},"bbox": [100.0, 0.0, 103.0, 3.0], "geometry" : { "type": "MultiPolygon",156    "coordinates": [157      [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],158      [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],...test_formatter.py
Source:test_formatter.py  
...39        self.f.writeln()40        self.f.writeln()41        self.f.writeln('b')42        self.assertOutput('a\n\n\nb\n')43    def test_multiline_write(self):44        self.f.writeln('a\nb')45        with self.f.indented(3, string='.'):46            self.f.writeln('c\n d\ne')47        self.f.writeln('f')48        self.assertOutput("a\nb\n...c\n... d\n...e\nf\n")49    def test_indentation(self):50        self.f.writeln("begin")51        with self.f.indented(3):52            self.f.writeln("a")53            self.f.writeln("b")54        self.f.writeln("end")55        self.assertOutput("begin\n   a\n   b\nend\n")56    def test_indentation_different_char_through_ctor(self):57        self._test__indentation_different_char(True)...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!!
