import pysat
import pysat.instruments.icon_ivm as icivm


class TestICONIVMCustom():
    def setup(self):
        """Runs before every method to create a clean testing setup."""
        # Load a test instrument
        self.testInst = pysat.Instrument('pysat', 'testing', tag='12',
                                         clean_level='clean')
        self.testInst.load(2009, 1)

    def teardown(self):
        """Runs after every method to clean up previous testing."""
        del self.testInst

    def test_remove_names_tag_level(self):
        self.testInst.tag = ''
        self.testInst.sat_id = 'a'

        self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
        icivm.remove_icon_names(self.testInst)
        # check prepended text removed
        assert (len(self.testInst['Blurp']) > 0)
        # check other names untouched
        assert (len(self.testInst['dummy1']) > 0)

    def test_remove_names_target(self):
        self.testInst.tag = ''
        self.testInst.sat_id = 'a'

        self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
        icivm.remove_icon_names(self.testInst, target='ICON_L27')
        # check prepended text removed
        assert (len(self.testInst['_Blurp']) > 0)
        # check other names untouched
        assert (len(self.testInst['dummy1']) > 0)

@@ -35,16 +35,23 @@
 nts.
-icon_ivm
+methods.general
  as 
@@ -530,17 +530,17 @@
 mes_
-tag_level
+wo_target
 (sel
@@ -693,34 +693,36 @@
 civm.remove_
-icon_names
+leading_text
 (self.testIn
@@ -741,36 +741,33 @@
 # check 
-prepended text remov
+variables unchang
 ed%0A     
@@ -796,16 +796,25 @@
 stInst%5B'
+ICON_L27_
 Blurp'%5D)
@@ -1106,18 +1106,20 @@
 ove_
-icon_names
+leading_text
 (sel
@@ -1268,32 +1268,32 @@
 names untouched%0A
-
         assert (
@@ -1306,28 +1306,502 @@
 lf.testInst%5B'dummy1'%5D) %3E 0)%0A
+%0A%0Aclass TestRemoveLeadTextXarray(TestICONIVMCustom):%0A    def setup(self):%0A        %22%22%22Runs before every method to create a clean testing setup.%22%22%22%0A        # Load a test instrument%0A        self.testInst = pysat.Instrument('pysat', 'testing_xarray', tag='12',%0A                                         clean_level='clean')%0A        self.testInst.load(2009, 1)%0A%0A    def teardown(self):%0A        %22%22%22Runs after every method to clean up previous testing.%22%22%22%0A        del self.testInst%0A

update tests for remove_leading_text