Beispiel #1
0
 def test_to_string_corner_cases(self, count, frac, expected):
     ph = Phase(count, frac)
     s = ph.to_string()
     assert s == expected
Beispiel #2
0
 def test_to_from_string_alwayssign(self):
     ph = Phase([[-10], [20]], [-0.4, 0.4])
     s = ph.to_string(alwayssign=True)
     ph2 = Phase.from_string(s)
     # No worries about round-off, since fractions relatively large.
     assert np.all(ph == ph2)
Beispiel #3
0
 def test_to_string_alwayssign(self):
     ph = Phase([[-10], [20]], [-0.4, 0.4])
     s = ph.to_string(alwayssign=True)
     assert np.all(s == [['-10.4', '-9.6'], ['+19.6', '+20.4']])
     for ph, expected in zip(ph.ravel(), s.ravel()):
         assert '{:+.1f}'.format(ph) == expected