@@ -528,12 +528,7 @@ def setUp(self):
528
528
self .cyclohexene .add_edge (5 , 14 , weight = 1.0 )
529
529
self .cyclohexene .add_edge (5 , 15 , weight = 1.0 )
530
530
531
- butadiene = Molecule .from_file (
532
- os .path .join (
533
- PymatgenTest .TEST_FILES_DIR ,
534
- "graphs/butadiene.xyz" ,
535
- )
536
- )
531
+ butadiene = Molecule .from_file (os .path .join (PymatgenTest .TEST_FILES_DIR , "graphs/butadiene.xyz" ))
537
532
self .butadiene = MoleculeGraph .with_empty_graph (butadiene , edge_weight_name = "strength" , edge_weight_units = "" )
538
533
self .butadiene .add_edge (0 , 1 , weight = 2.0 )
539
534
self .butadiene .add_edge (1 , 2 , weight = 1.0 )
@@ -545,12 +540,7 @@ def setUp(self):
545
540
self .butadiene .add_edge (3 , 8 , weight = 1.0 )
546
541
self .butadiene .add_edge (3 , 9 , weight = 1.0 )
547
542
548
- ethylene = Molecule .from_file (
549
- os .path .join (
550
- PymatgenTest .TEST_FILES_DIR ,
551
- "graphs/ethylene.xyz" ,
552
- )
553
- )
543
+ ethylene = Molecule .from_file (os .path .join (PymatgenTest .TEST_FILES_DIR , "graphs/ethylene.xyz" ))
554
544
self .ethylene = MoleculeGraph .with_empty_graph (ethylene , edge_weight_name = "strength" , edge_weight_units = "" )
555
545
self .ethylene .add_edge (0 , 1 , weight = 2.0 )
556
546
self .ethylene .add_edge (0 , 2 , weight = 1.0 )
@@ -669,16 +659,17 @@ def test_coordination(self):
669
659
assert self .cyclohexene .get_coordination_of_site (0 ) == 4
670
660
671
661
def test_edge_editing (self ):
672
- self .cyclohexene .alter_edge (0 , 1 , new_weight = 0.0 , new_edge_properties = {"foo" : "bar" })
673
- new_edge = self .cyclohexene .graph .get_edge_data (0 , 1 )[0 ]
662
+ cyclohexene = copy .deepcopy (self .cyclohexene )
663
+ cyclohexene .alter_edge (0 , 1 , new_weight = 0.0 , new_edge_properties = {"foo" : "bar" })
664
+ new_edge = cyclohexene .graph .get_edge_data (0 , 1 )[0 ]
674
665
assert new_edge ["weight" ] == 0.0
675
666
assert new_edge ["foo" ] == "bar"
676
667
677
- self . cyclohexene .break_edge (0 , 1 )
678
- assert self . cyclohexene .graph .get_edge_data (0 , 1 ) is None
668
+ cyclohexene .break_edge (0 , 1 )
669
+ assert cyclohexene .graph .get_edge_data (0 , 1 ) is None
679
670
680
671
# Replace the now-broken edge
681
- self . cyclohexene .add_edge (0 , 1 , weight = 1.0 )
672
+ cyclohexene .add_edge (0 , 1 , weight = 1.0 )
682
673
683
674
def test_insert_remove (self ):
684
675
mol_copy = copy .deepcopy (self .ethylene .molecule )
0 commit comments