Skip to content

Commit

Permalink
crystal: Fixed .as_str readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Somerandomguy10111 committed Jul 1, 2024
1 parent 3532412 commit 2d2b92e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CrystalStructure/crystal/crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def to_pymatgen(self) -> Structure:
def as_str(self) -> str:
the_dict = asdict(self)
the_dict = {str(key) : str(value) for key, value in the_dict.items() if not isinstance(value, Structure)}
the_dict['atoms'] = f'{self.base[0]}, ...'
the_dict['base'] = f'{self.base[0]}, ...'
return json.dumps(the_dict, indent='-')

def __str__(self):
Expand Down
7 changes: 3 additions & 4 deletions tests/t_base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from CrystalStructure.crystal.atomic_site import AtomType

from CrystalStructure.crystal import CrystalBase, AtomicSite
from holytools.devtools import Unittest
from pymatgen.core import Species

from CrystalStructure.crystal import CrystalBase, AtomicSite
from CrystalStructure.crystal.atomic_site import AtomType
from CrystalStructure.examples import CrystalExamples


# ---------------------------------------------------------

class TestCrystalBase(Unittest):
Expand Down

0 comments on commit 2d2b92e

Please sign in to comment.