Ejemplo n.º 1
0
class TestInputFile(AbipyFileTest):
    """Unit tests for InputFile."""
    def setUp(self):
        self.file = InputFile('MyDir/MyName.in')

    def test_set_variable_attribute(self):
        """Test setting variables by attribute."""
        self.file.ecut = 10.
        self.assertContains('ecut 10.')

    def test_set_variable_function(self):
        """Test setting variables with set_variable."""
        self.file.set_variable('ecut', 10.)
        self.assertContains('ecut 10.')

    def test_set_variables_function(self):
        """Test setting variables with set_variables."""

        self.file.set_variables({'ecut': 10., 'nstep': 100})
        self.assertContains('nstep 100')
        self.assertContains('ecut 10.')

        self.file.set_variables({'ecut': 10., 'nstep': 100}, 1)
        self.assertContains('nstep1 100')
        self.assertContains('ecut1 10.')
Ejemplo n.º 2
0
class TestInputFile(AbipyFileTest):
    """Unit tests for InputFile."""

    def setUp(self):
        self.file = InputFile('MyDir/MyName.in')

    def test_set_variable_attribute(self):
        """Test setting variables by attribute."""
        self.file.ecut = 10.
        self.assertContains('ecut 10.')

    def test_set_variable_function(self):
        """Test setting variables with set_variable."""
        self.file.set_variable('ecut', 10.)
        self.assertContains('ecut 10.')

    def test_set_variables_function(self):
        """Test setting variables with set_variables."""

        self.file.set_variables({'ecut':10., 'nstep':100})
        self.assertContains('nstep 100')
        self.assertContains('ecut 10.')

        self.file.set_variables({'ecut':10., 'nstep':100}, 1)
        self.assertContains('nstep1 100')
        self.assertContains('ecut1 10.')
Ejemplo n.º 3
0
 def setUp(self):
     self.file = InputFile('MyDir/MyName.in')
Ejemplo n.º 4
0
 def setUp(self):
     self.file = InputFile('MyDir/MyName.in')