import numpy as np
import pytest

import mbuild as mb
from mbuild.tests.base_test import BaseTest


class TestXYZ(BaseTest):

    def test_save(self, ethane):
        ethane.save(filename='ethane.xyz')

import numpy as np
import pytest

import mbuild as mb
from mbuild.tests.base_test import BaseTest


class TestXYZ(BaseTest):

    def test_save(self, ethane):
        ethane.save(filename='ethane.xyz')
        ethane.save(filename='ethane.pdb')
        ethane_in = mb.load('ethane.xyz', top='ethane.pdb')
        assert len(ethane_in.children) == 8
        assert set([child.name for child in ethane_in.children]) == {'C', 'H'}

Add sanity checks to tests
Add sanity checks to tests

This should be cleaned up with an XYZ read that does not require reading in an
extra file (mdtraj requires a file with topological information, in this case
PDB file).

  import numpy as np
  import pytest
  
  import mbuild as mb
  from mbuild.tests.base_test import BaseTest
  
  
  class TestXYZ(BaseTest):
  
      def test_save(self, ethane):
          ethane.save(filename='ethane.xyz')
+         ethane.save(filename='ethane.pdb')
+         ethane_in = mb.load('ethane.xyz', top='ethane.pdb')
+         assert len(ethane_in.children) == 8
+         assert set([child.name for child in ethane_in.children]) == {'C', 'H'}
  
Add sanity checks to tests
## Code Before:
import numpy as np
import pytest

import mbuild as mb
from mbuild.tests.base_test import BaseTest


class TestXYZ(BaseTest):

    def test_save(self, ethane):
        ethane.save(filename='ethane.xyz')

## Instruction:
Add sanity checks to tests
## Code After:
import numpy as np
import pytest

import mbuild as mb
from mbuild.tests.base_test import BaseTest


class TestXYZ(BaseTest):

    def test_save(self, ethane):
        ethane.save(filename='ethane.xyz')
        ethane.save(filename='ethane.pdb')
        ethane_in = mb.load('ethane.xyz', top='ethane.pdb')
        assert len(ethane_in.children) == 8
        assert set([child.name for child in ethane_in.children]) == {'C', 'H'}
