@@ -452,6 +452,7 @@ A line must have at least two points.
452452Because of the similarities between polygon and line types it is possible to create
453453a line shape using either the "line" or "poly" method.
454454
455+
455456 >>> w = shapefile.Writer()
456457
457458 >>> w.line(parts=[[[ 1,5] ,[ 5,5] ,[ 5,1] ,[ 3,3] ,[ 1,1]]] )
@@ -546,14 +547,12 @@ To store very large numbers you must increase the field length size to the total
546547 >>> w.save('shapefiles/test/dtype')
547548
548549 >>> r = shapefile.Reader('shapefiles/test/dtype')
549- >>> r.record(0)
550- [1, 1.32, 1.3217328, -3.2302e-25, 1.3217328, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000L]
551- >>> r.record(1)
552- [None, None, None, None, None, None]
550+ >>> assert r.record(0) == [1, 1.32, 1.3217328, -3.2302e-25, 1.3217328, 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
551+ >>> assert r.record(1) == [None, None, None, None, None, None]
553552
554553
555554Finally, we can create boolean fields by setting the type to 'L'.
556- This field can take True or False values, or any string whose first character is one of YyTt (True) or NnFf (False).
555+ This field can take True or False values, or 1 (True) or 0 (False).
557556None is interpreted as missing.
558557
559558
@@ -565,22 +564,30 @@ None is interpreted as missing.
565564 >>> w.null()
566565 >>> w.null()
567566 >>> w.record(True)
568- >>> w.record("Yes" )
567+ >>> w.record(1 )
569568 >>> w.record(False)
570- >>> w.record("No" )
569+ >>> w.record(0 )
571570 >>> w.record(None)
571+ >>> w.record("Nonesense")
572572 >>> w.save('shapefiles/test/dtype')
573573
574574 >>> r = shapefile.Reader('shapefiles/test/dtype')
575- >>> assert r.record(0) == [True]
576- >>> assert r.record(1) == [True]
577- >>> assert r.record(2) == [False]
578- >>> assert r.record(3) == [False]
579- >>> assert r.record(4) == [None]
580-
575+ >>> r.record(0)
576+ [True]
577+ >>> r.record(1)
578+ [True]
579+ >>> r.record(2)
580+ [False]
581+ >>> r.record(3)
582+ [False]
583+ >>> r.record(4)
584+ [None]
585+ >>> r.record(5)
586+ [None]
581587
582588You can also add attributes using keyword arguments where the keys are field names.
583589
590+
584591 >>> w = shapefile.Writer()
585592 >>> w.field('FIRST_FLD','C','40')
586593 >>> w.field('SECOND_FLD','C','40')
0 commit comments