Skip to content

Commit

Permalink
fix test with regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
smiet committed Jul 23, 2024
1 parent dec6824 commit 3cff8b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/field/test_normal_field.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import unittest
import logging
import re

import numpy as np
from monty.tempfile import ScratchDir
Expand Down Expand Up @@ -576,9 +577,9 @@ def test_double_reduction(self):
coilset = CoilSet(base_coils=base_coils, surface=surface)
cnf = CoilNormalField(coilset)
cnf.reduce_coilset()
num1 = int(cnf.dof_names[0][14]) # grab 'ReducedCoilSet*N* from first dof name
num1 = int(re.search(r'\d+', cnf.dof_names[0]).group()) # grab 'ReducedCoilSet*N* from first dof name
cnf.reduce_coilset()
num2 = int(cnf.dof_names[0][14]) # grab 'ReducedCoilSet*N* from first dof name
num2 = int(re.search(r'\d+', cnf.dof_names[0]).group()) # grab 'ReducedCoilSet*N* from first dof name
self.assertEqual(num2-num1, 1) # Coilset sucessfully replaced


Expand Down

0 comments on commit 3cff8b3

Please sign in to comment.