示例#1
0
    def test_1(self):
        self.add('a', nargs='+', type=int)
        self.cmd('-a 1 2')

        eq_(self.v.a, [1, 2])
示例#2
0
 def test_9(self):
     self.add('a', default=False, action='store_true', type=bool)
     self.cmd('')
     eq_(self.v.a, False)
示例#3
0
 def test_1(self):
     self.add('a', nargs='+', type=int)
     self.cmd('-a 1 2')
     
     eq_(self.v.a, [1, 2])
示例#4
0
 def test_7(self):
     self.add('a', action='store_true', type=bool)
     self.cmd('-a')
     eq_(self.v.a, True)
示例#5
0
 def test_8(self):
     self.add('a', action='store_true')
     self.cmd('-a')
     eq_(self.v.a, True)
示例#6
0
 def test_4(self):
     sys.stderr = open('/dev/null', 'w')
     self.add('a', choices=[1, 2], type=float)
     self.cmd('-a 5')
     eq_(self.v.a, 5.0)
     sys.stderr = sys.__stderr__
示例#7
0
def test_iterator():
    from msmbuilder.arglib import _iter_both_cases
    got = [e for e in _iter_both_cases("string")]
    expected = ['s', 'S', 't', 'T', 'r', 'R', 'i', 'I', 'n', 'N', 'g', 'G']

    eq_(got, expected)
示例#8
0
 def test_6(self):
     self.add('a', choices=[1, 2], type=int)
     self.cmd('-a 1')
     eq_(self.v.a, 1)
示例#9
0
 def test_7(self):
     self.add('a', action='store_true', type=bool)
     self.cmd('-a')
     eq_(self.v.a, True)
示例#10
0
 def test_4(self):
     sys.stderr = open('/dev/null', 'w')
     self.add('a', choices=[1,2], type=float)
     self.cmd('-a 5')
     eq_(self.v.a, 5.0)
     sys.stderr = sys.__stderr__
示例#11
0
 def test_5(self):
     self.add('a', choices=['1', '2'], type=int)
     self.cmd('-a 1')
     eq_(self.v.a, 1.0)
示例#12
0
def test_iterator():
    from msmbuilder.arglib import _iter_both_cases
    got = [e for e in _iter_both_cases("string")]
    expected = ['s', 'S', 't', 'T', 'r', 'R', 'i', 'I', 'n', 'N', 'g', 'G']

    eq_(got, expected)
示例#13
0
 def test_3(self):
     self.add('a', type=float)
     self.cmd('-a 5')
     eq_(self.v.a, 5.0)
示例#14
0
 def test_2(self):
     self.add('a', type=int)
     self.cmd('-a 4')
     eq_(self.v.a, 4)
示例#15
0
 def test_2(self):
     self.add('a', type=int)
     self.cmd('-a 4')
     eq_(self.v.a, 4)
示例#16
0
 def test_71(self):
     self.add('a', action='store_false', type=bool)
     self.cmd('-a')
     eq_(self.v.a, False)
示例#17
0
 def test_3(self):
     self.add('a', type=float)
     self.cmd('-a 5')
     eq_(self.v.a, 5.0)
示例#18
0
 def test_8(self):
     self.add('a', action='store_true')
     self.cmd('-a')
     eq_(self.v.a, True)
示例#19
0
 def test_5(self):
     self.add('a', choices=['1', '2'], type=int)
     self.cmd('-a 1')
     eq_(self.v.a, 1.0)
示例#20
0
 def test_81(self):
     self.add('b', action='store_false')
     self.cmd('-b')
     eq_(self.v.b, False)
示例#21
0
 def test_6(self):
     self.add('a', choices=[1, 2], type=int)
     self.cmd('-a 1')
     eq_(self.v.a, 1)
示例#22
0
 def test_9(self):
     self.add('a', default=False, action='store_true', type=bool)
     self.cmd('')
     eq_(self.v.a, False)    
示例#23
0
 def test_71(self):
     self.add('a', action='store_false', type=bool)
     self.cmd('-a')
     eq_(self.v.a, False)
示例#24
0
 def test_10(self):
     self.add('a', action='store_true', type=bool)
     self.cmd('')
     eq_(self.v.a, False)
示例#25
0
 def test_81(self):
     self.add('b', action='store_false')
     self.cmd('-b')
     eq_(self.v.b, False)
示例#26
0
 def test_0(self):
     self.add('a', nargs='+')
     self.cmd('-a 1 2')
     eq_(self.v.a, ['1', '2'])
示例#27
0
 def test_10(self):
     self.add('a', action='store_true', type=bool)
     self.cmd('')
     eq_(self.v.a, False)
示例#28
0
 def test_0(self):
     self.add('a', nargs='+')
     self.cmd('-a 1 2')
     eq_(self.v.a, ['1', '2'])