Esempio n. 1
0
    def test_wrong_n_atoms(self, outfile):
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with NCDFWriter(outfile, 100) as w:
            u = make_Universe(trajectory=True)
            with pytest.raises(IOError):
                w.write(u.trajectory.ts)
Esempio n. 2
0
    def test_no_ts(self, outfile):
        # no ts supplied at any point
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with NCDFWriter(outfile, 100) as w:
            with pytest.raises(IOError):
                w.write_next_timestep()
Esempio n. 3
0
    def test_import_netcdfwriter(self):
        # do it here because netcdf isn't required
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with NCDFWriter('myfile.ncdf', 100) as wr:
            try:
                wr._init_netcdf()
            except ImportError as e:
                assert_('netCDF4 package missing' in e.args[0])
                assert_('See installation instructions at' in e.args[0])
            else:
                raise AssertionError
Esempio n. 4
0
    def test_zero_atoms_VE(self, outfile):
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with pytest.raises(ValueError):
            NCDFWriter(outfile, 0)
Esempio n. 5
0
    def test_no_ts(self):
        # no ts supplied at any point
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with NCDFWriter(self.outfile, 100) as w:
            assert_raises(IOError, w.write_next_timestep)
Esempio n. 6
0
    def test_wrong_n_atoms(self):
        from MDAnalysis.coordinates.TRJ import NCDFWriter

        with NCDFWriter(self.outfile, 100) as w:
            u = make_Universe(trajectory=True)
            assert_raises(IOError, w.write, u.trajectory.ts)
Esempio n. 7
0
 def test_scale_factor_future(self, outfile):
     u = mda.Universe(GRO)
     wmsg = "`scale_factor` writing will change"
     with pytest.warns(FutureWarning, match=wmsg):
         with NCDFWriter(outfile, u.trajectory.n_atoms) as w:
             w.write(u.atoms)
Esempio n. 8
0
 def test_wrong_n_atoms(self, outfile):
     with NCDFWriter(outfile, 100) as w:
         u = make_Universe(trajectory=True)
         with pytest.raises(IOError):
             w.write(u.trajectory.ts)
Esempio n. 9
0
 def test_zero_atoms_VE(self, outfile):
     with pytest.raises(ValueError):
         NCDFWriter(outfile, 0)