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)
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()
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
def test_zero_atoms_VE(self, outfile): from MDAnalysis.coordinates.TRJ import NCDFWriter with pytest.raises(ValueError): NCDFWriter(outfile, 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)
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)
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)
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)
def test_zero_atoms_VE(self, outfile): with pytest.raises(ValueError): NCDFWriter(outfile, 0)