Changeset cb11a25 in sasview


Ignore:
Timestamp:
Nov 4, 2017 9:20:24 AM (7 years ago)
Author:
Stuart Prescott <stuart@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
b6b81a3, 0675e6b
Parents:
08b9e331
git-author:
Stuart Prescott <stuart@…> (11/01/17 18:48:52)
git-committer:
Stuart Prescott <stuart@…> (11/04/17 09:20:24)
Message:

Fix instance vs class variables in FileReader?

Class variables get inherited and shared between different instantiations
of the class and this means that the current usage of TestFileReader? in
utest_generic_file_reader_class.py has side-effects that would cause
subsequent tests to fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    r20fa5fe rcb11a25  
    2727 
    2828class FileReader(object): 
    29     # List of Data1D and Data2D objects to be sent back to data_loader 
    30     output = [] 
    31     # Current plottable_(1D/2D) object being loaded in 
    32     current_dataset = None 
    33     # Current DataInfo object being loaded in 
    34     current_datainfo = None 
    3529    # String to describe the type of data this reader can load 
    3630    type_name = "ASCII" 
     
    4337    # Able to import the unit converter 
    4438    has_converter = True 
    45     # Open file handle 
    46     f_open = None 
    4739    # Default value of zero 
    4840    _ZERO = 1e-16 
     41 
     42    def __init__(self): 
     43        # List of Data1D and Data2D objects to be sent back to data_loader 
     44        self.output = [] 
     45        # Current plottable_(1D/2D) object being loaded in 
     46        self.current_dataset = None 
     47        # Current DataInfo object being loaded in 
     48        self.current_datainfo = None 
     49        # Open file handle 
     50        self.f_open = None 
    4951 
    5052    def read(self, filepath): 
Note: See TracChangeset for help on using the changeset viewer.