Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for writing file with empty ~P section (#67) #69

Merged
merged 4 commits into from
Aug 11, 2015

Conversation

kinverarity1
Copy link
Owner

No description provided.

@kinverarity1
Copy link
Owner Author

The original error from #67

Traceback (most recent call last):
 File "memgauge2las.py", line 46, in 
 l.write(f,2)
 File "/home/bdi/projects/lasfbe_dev/lasio/lasio/las.py", line 353, in write
 section_widths = get_section_widths("params", self.params, version)
 File "/home/bdi/projects/lasfbe_dev/lasio/lasio/las.py", line 790, in get_section_widths
 section_widths["left_width"] = max([len(i.mnemonic) for i in items])
 ValueError: max() arg is an empty sequence

@kinverarity1
Copy link
Owner Author

The error I'm getting in the test suite:

================================== FAILURES ===================================
_______________________ test_write_sample_empty_params ________________________

    def test_write_sample_empty_params():
        l = read(egfn("sample_write_empty_params.las"))
>       l.write(StringIO(), version=2)

lasio\test_write.py:166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lasio\las.py:353: in write
    section_widths = get_section_widths("params", self.params, version)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

section_name = 'params', section = {}, version = 2, middle_padding = 5

    def get_section_widths(section_name, section, version, middle_padding=5):
        '''Find minimum section widths fitting the content in *section*.

        Args:
          section_name (str): either "version", "well", "curves", or "params"
          section (dict|list): section items
          version (float): either 1.2 or 2.0

        '''
        section_widths = {}
        if isinstance(section, dict):
            items = section.values()
        elif isinstance(section, list):
            items = list(section)

>       section_widths["left_width"] = max([len(i.mnemonic) for i in items])
E       ValueError: max() arg is an empty sequence

lasio\las.py:790: ValueError
===================== 1 failed, 23 passed in 3.67 seconds =====================

@kinverarity1 kinverarity1 merged commit 2d8f2b5 into master Aug 11, 2015
@kinverarity1 kinverarity1 deleted the writeemptysection branch December 4, 2015 21:53
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant