コード例 #1
0
ファイル: test_parameters.py プロジェクト: pv/sumatra
 def test__init__should_ignore_comment_lines(self):
     init = textwrap.dedent("""\
         #some parameters
         x = 2
         # this is a comment at column 0
           # this is an indented comment
           y = 3
         # this is a comment line containing an 'equals' sign: n=42
         """)
     P = SimpleParameterSet(init)
     self.assertEqual(P["x"], 2)
     self.assertEqual(P["y"], 3)
     self.assertEqual(set(P.as_dict().keys()), set(["x", "y"]))
コード例 #2
0
ファイル: test_parameters.py プロジェクト: teogale/sumatra
 def test__init__should_ignore_comment_lines(self):
     init = textwrap.dedent("""\
         #some parameters
         x = 2
         # this is a comment at column 0
           # this is an indented comment
           y = 3
         # this is a comment line containing an 'equals' sign: n=42
         """)
     P = SimpleParameterSet(init)
     self.assertEqual(P["x"], 2)
     self.assertEqual(P["y"], 3)
     self.assertEqual(set(P.as_dict().keys()), set(["x", "y"]))
コード例 #3
0
ファイル: test_parameters.py プロジェクト: pv/sumatra
 def test__pop(self):
     P = SimpleParameterSet("x = 2\ny = 3")
     self.assertEqual(P.pop('x'), 2)
     self.assertEqual(P.as_dict(), {'y': 3})
     self.assertEqual(P.pop('foo', 42), 42)
     self.assertEqual(P.pop('foo', None), None)
コード例 #4
0
ファイル: test_parameters.py プロジェクト: teogale/sumatra
 def test__pop(self):
     P = SimpleParameterSet("x = 2\ny = 3")
     self.assertEqual(P.pop('x'), 2)
     self.assertEqual(P.as_dict(), {'y': 3})
     self.assertEqual(P.pop('foo', 42), 42)
     self.assertEqual(P.pop('foo', None), None)