Beispiel #1
0
 def test_en_ed_input_99(self):
     inp = '''10000.'''
     fmt = '''(EN10.5E5)'''
     result = [1.0000000000000000e+04]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_44(self):
     inp = '''0.1'''
     fmt = '''(G10.4E5)'''
     result = [1.0000000000000001e-01]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_51(self):
     inp = '''-0.0001'''
     fmt = '''(G10.4E5)'''
     result = [-1.0000000000000000e-04]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_26(self):
     inp = '''1D12'''
     fmt = '''(G5.4E5)'''
     result = [1.0000000000000000e+08]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_41(self):
     inp = '''100000.'''
     fmt = '''(G10.4E5)'''
     result = [1.0000000000000000e+05]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_148(self):
     inp = '''.'''
     fmt = '''(G10.10E5)'''
     result = [0.0000000000000000e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_21(self):
     inp = '''-0.0001'''
     fmt = '''(G5.4E5)'''
     result = [0.0000000000000000e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_1(self):
     inpt = [3.1]
     fmt = '(F5.0)'
     eds, rev_eds = _parser(_lexer(fmt))
     result = '   3.'
     self.assertEqual(result, _output(eds, rev_eds, inpt))
 def test_2(self):
     inpt = [99999.01]
     fmt = '(F6.0)'
     eds, rev_eds = _parser(_lexer(fmt))
     result = '99999.'
     self.assertEqual(result, _output(eds, rev_eds, inpt))
 def test_7(self):
     # Positional editdescriptors always raise error when passed a
     # zero argument
     fmt = ('0X')
     toks = _lexer(fmt)
     self.assertRaises(InvalidFormat, _parser, toks)
 def e_output_test_2(self):
     inpt = [1.0]
     fmt = '(E10.1)'
     eds, rev_eds = _parser(_lexer(fmt))
     result = "   0.1E+01"
     self.assertEqual(result, _output(eds, rev_eds, inpt))
Beispiel #12
0
 def apostrophe_output_test_2(self):
   '''With commented apostrophe'''
   fmt = "'Don''t you, forget about me'"
   eds, rev_eds = _parser(_lexer(fmt))
   result = "Don't you, forget about me"
   self.assertEqual(result, _output(eds, rev_eds, []))
Beispiel #13
0
 def apostrophe_output_test_1(self):
   fmt = "'Some Text'"
   eds, rev_eds = _parser(_lexer(fmt))
   result = "Some Text"
   self.assertEqual(result, _output(eds, rev_eds, []))
 def g_output_test_1(self):
     inpt = [0.0]
     fmt = '(G10.2)'
     eds, rev_eds = _parser(_lexer(fmt))
     result = "  0.00E+00"
     self.assertEqual(result, _output(eds, rev_eds, inpt))
 def test_g_ed_input_143(self):
     inp = '''3.14159'''
     fmt = '''(G10.10E5)'''
     result = [3.1415899999999999e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
Beispiel #16
0
 def multi_test_8(self):
     inpt = '1234567890'
     fmt = '(A, A)'
     eds, rev_eds = _parser(_lexer(fmt))
     result = ['1234567890', '']
     self.assertEqual(result, _input(eds, rev_eds, inpt))
 def test_g_ed_input_147(self):
     inp = '''-1   d12'''
     fmt = '''(G10.10E5)'''
     result = [-1.0000000000000000e+02]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_l_ed_input_2(self):
     inp = '''.FALSE.'''
     fmt = '''(L1)'''
     result = ['''ERR''']
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertRaises(ValueError, _input, eds, rev_eds, inp)
 def test_g_ed_input_18(self):
     inp = '''0.001'''
     fmt = '''(G5.4E5)'''
     result = [1.0000000000000000e-03]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_l_ed_input_8(self):
     inp = '''F'''
     fmt = '''(L2)'''
     result = [False]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_23(self):
     inp = '''3.14159'''
     fmt = '''(G5.4E5)'''
     result = [3.1410000000000000e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_l_ed_input_9(self):
     inp = '''.TRUE.'''
     fmt = '''(L3)'''
     result = [True]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_32(self):
     inp = '''-3.'''
     fmt = '''(G10.4E5)'''
     result = [-3.0000000000000000e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_115(self):
     inp = '''1d12'''
     fmt = '''(G10.5E5)'''
     result = [1.0000000000000000e+07]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_43(self):
     inp = '''123456789.'''
     fmt = '''(G10.4E5)'''
     result = [1.2345678900000000e+08]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_120(self):
     inp = '''0.1E+200'''
     fmt = '''(G10.5E5)'''
     result = [1.0000000000000001e+199]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_4(self):
     inp = '''-10.'''
     fmt = '''(G5.4E5)'''
     result = [-1.0000000000000000e+01]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_13(self):
     inp = '''123456789.'''
     fmt = '''(G5.4E5)'''
     result = [1.2344999999999999e+00]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
 def test_g_ed_input_52(self):
     inp = '''-1.96e-16'''
     fmt = '''(G10.4E5)'''
     result = [-1.9600000000000000e-16]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))
Beispiel #30
0
 def test_en_ed_input_90(self):
     inp = '''0.1D+200'''
     fmt = '''(EN5.5E5)'''
     result = [1.0000000000000001e-01]
     eds, rev_eds = _parser(_lexer(fmt))
     self.assertEqual(result, _input(eds, rev_eds, inp))