コード例 #1
0
 def test_generates_line_with_variable_reference(self):
     line = EqualAssertionLine(ImmutableObject('string'),
                               ModuleVariableReference('mod', 'var', 1.5),
                               2)
     result = generate_test_contents([line], unittest_template)
     assert_equal_strings("self.assertEqual('string', mod.var)\n", result)
     assert_equal(set(['mod']), result.imports)
コード例 #2
0
 def test_generates_assertion_line(self):
     aline = EqualAssertionLine(create(SequenceObject),
                                create(FunctionCall), 1)
     assert_equal_strings(
         "self.assertEqual([], function())\n",
         generate_test_contents([aline], unittest_template))
コード例 #3
0
 def test_adds_import_for_an_assertion_line(self):
     aline = EqualAssertionLine(create(SequenceObject),
                                create(FunctionCall), 1)
     assert_equal(
         set([('module', 'function')]),
         generate_test_contents([aline], unittest_template).imports)
コード例 #4
0
 def setUp(self):
     self.alist = create(SequenceObject)
     self.call = create(FunctionCall,
                        args={'x': self.alist},
                        definition=create(Function, args=['x']))
     self.aline = EqualAssertionLine(self.alist, self.call, 0)