コード例 #1
0
    def test_int(self):
        """ Test that affe(int, ...) also works """
        atomic_number = randint(1, 103)
        nG = np.random.random(size=(16, 32))

        from_int = affe(atomic_number, nG)
        from_atom = affe(Atom(atomic_number, [0, 0, 0]), nG)

        self.assertTrue(np.allclose(from_int, from_atom))
コード例 #2
0
    def test_str(self):
        """ Test that affe(str, ...) also works """
        # Try with Chlorine (Z = 17)
        atomic_number = 17
        nG = np.random.random(size=(16, 32))

        from_int = affe(atomic_number, nG)
        from_str = affe("Cl", nG)

        self.assertTrue(np.allclose(from_int, from_str))
コード例 #3
0
 def test_side_effects(self):
     nG = np.random.random(size=(16, 32))
     nG.setflags(write=False)  # if nG is written to, Exception is raised
     affe(Atom("He", coords=[0, 0, 0]), nG)
コード例 #4
0
 def test_out_shape(self):
     nG = np.random.random(size=(16, 32))
     eff = affe(Atom("He", coords=[0, 0, 0]), nG)
     self.assertSequenceEqual(eff.shape, nG.shape)
コード例 #5
0
def test_out_shape():
    nG = np.random.random(size=(16, 32))
    eff = affe(Atom("He", coords=[0, 0, 0]), nG)
    assert eff.shape == nG.shape