Changeset - 6a3d64ff2250
[Not reviewed]
0 3 0
Brett Smith - 3 years ago 2021-01-09 15:49:04
brettcsmith@brettcsmith.org
fields: Change FieldType capitalization.

This is friendlier to the YAML input and consistent with FieldFlags.
Less consistent with the rest of the codebase, but local consistency matters
more IMO.
3 files changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/pdfforms/fields.py
Show inline comments
...
 
@@ -55,10 +55,9 @@ class FieldType(enum.Enum):
 
    Btn = 'Btn'
 
    BUTTON = Btn
 
    Button = Btn
 
    Ch = 'Ch'
 
    CHOICE = Ch
 
    Choice = Ch
 
    Sig = 'Sig'
 
    SIG = Sig
 
    SIGNATURE = Sig
 
    Signature = Sig
 
    Tx = 'Tx'
 
    TEXT = Tx
 
    Text = Tx
 

	
...
 
@@ -89,3 +88,3 @@ class FormField:
 
        flags = retval.flags()
 
        if field_type is FieldType.BUTTON:
 
        if field_type is FieldType.Button:
 
            if flags & FieldFlags.Radio:
...
 
@@ -96,3 +95,3 @@ class FormField:
 
                retval.__class__ = CheckboxField
 
        elif field_type is FieldType.TEXT:
 
        elif field_type is FieldType.Text:
 
            retval.__class__ = TextField
setup.py
Show inline comments
...
 
@@ -7,3 +7,3 @@ setup(
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.15.0',
 
    version='1.15.1',
 
    author='Software Freedom Conservancy',
tests/test_pdfforms_fields.py
Show inline comments
...
 
@@ -67,3 +67,3 @@ def test_text_field_base():
 
    field = fieldsmod.FormField(source)
 
    assert field.field_type() is fieldsmod.FieldType.TEXT
 
    assert field.field_type() is fieldsmod.FieldType.Text
 
    assert field.name() == 's'
...
 
@@ -75,3 +75,3 @@ def test_checkbox_field_base(value):
 
    field = fieldsmod.FormField(source)
 
    assert field.field_type() is fieldsmod.FieldType.BUTTON
 
    assert field.field_type() is fieldsmod.FieldType.Button
 
    assert field.name() == 'cb'
...
 
@@ -116,3 +116,3 @@ def test_inheritance():
 
    assert field.name() == 'kid'
 
    assert field.field_type() is fieldsmod.FieldType.TEXT
 
    assert field.field_type() is fieldsmod.FieldType.Text
 
    assert field.value() == 'parent value'
0 comments (0 inline, 0 general)