Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_access_component_by_index(self):
m = self.model
g1 = Gaussian()
g2 = Gaussian()
g2.name = "test"
m.extend((g1, g2))
nose.tools.assert_is(m[1], g2)
@nose.tools.raises(ValueError)
def test_get_component_wrong(self):
m = self.model
g1 = Gaussian()
g2 = Gaussian()
g2.name = "test"
m.extend((g1, g2))
m._get_component(1.2)
def test_component_name_when_append(self):
m = self.model
gs = [Gaussian(), Gaussian(), Gaussian()]
m.extend(gs)
nose.tools.assert_is(m['Gaussian'], gs[0])
nose.tools.assert_is(m['Gaussian_0'], gs[1])
nose.tools.assert_is(m['Gaussian_1'], gs[2])
def test_several_component_with_same_name(self):
m = self.model
gs = [Gaussian(), Gaussian(), Gaussian()]
m.extend(gs)
m[0]._name = "Gaussian"
m[1]._name = "Gaussian"
m[2]._name = "Gaussian"
m['Gaussian']
def test_get_component_by_index(self):
m = self.model
g1 = Gaussian()
g2 = Gaussian()
g2.name = "test"
m.extend((g1, g2))
nose.tools.assert_is(m._get_component(1), g2)
def test_component_already_in_model(self):
m = self.model
g1 = Gaussian()
m.extend((g1, g1))
def test_access_component_by_name(self):
m = self.model
g1 = Gaussian()
g2 = Gaussian()
g2.name = "test"
m.extend((g1, g2))
nose.tools.assert_is(m["test"], g2)
def test_get_component_by_component(self):
m = self.model
g1 = Gaussian()
g2 = Gaussian()
g2.name = "test"
m.extend((g1, g2))
nose.tools.assert_is(m._get_component(g2), g2)