コード例 #1
0
ファイル: test_comparison.py プロジェクト: connoryang/1v1dec
 def test_repr_class(self):
     self.assertEqual(repr(C('testfixtures.tests.sample1.TestClassA')), '<C:testfixtures.tests.sample1.TestClassA>')
コード例 #2
0
 def test_repr_class(self):
     compare_repr(C('testfixtures.tests.sample1.SampleClassA'),
                  '<C:testfixtures.tests.sample1.SampleClassA>')
コード例 #3
0
 def test_repr_instance(self):
     compare_repr(
         C(SampleClassA('something')),
         "<C:testfixtures.tests.sample1.SampleClassA>"
         "args: ('something',)"
         "</C>")
コード例 #4
0
 def test_no___dict___partial_same(self):
     x = X()
     x.x = 1
     self.assertEqual(C(X, x=1, partial=True), x)
コード例 #5
0
 def test_class_defines_comparison_strictly(self):
     self.assertEqual(
         C('testfixtures.tests.test_comparison.FussyDefineComparison',
           attr=1),
         FussyDefineComparison(1)
         )
コード例 #6
0
 def test_exception_instance_and_args(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError('bar'), args=('foo', ))
         )
コード例 #7
0
 def test_exception_no_args_different(self):
     self.assertNotEqual(
         WeirdException(1, 2),
         C(WeirdException(1, 3))
         )
コード例 #8
0
 def test_second(self):
     self.assertEqual(
         SampleClassA(),
         C('testfixtures.tests.sample1.SampleClassA'),
         )
コード例 #9
0
 def test_not_same_first(self):
     self.assertNotEqual(
         C('datetime'),
         SampleClassA()
         )
コード例 #10
0
 def test_repr_class_and_vars(self):
     compare_repr(
         C(SampleClassA, {'args': (1,)}),
         "<C:testfixtures.tests.sample1.SampleClassA>args: (1,)</C>"
     )
コード例 #11
0
 def test_first(self):
     self.assertEqual(
         C('testfixtures.tests.sample1.SampleClassA'),
         SampleClassA()
         )
コード例 #12
0
ファイル: test_comparison.py プロジェクト: connoryang/1v1dec
 def test_repr_exception(self):
     self.assertEqual(repr(C(ValueError('something'))), "\n  <C:{0}.ValueError>\n  args:('something',)\n  </C>".format(exception_module))
コード例 #13
0
ファイル: test_comparison.py プロジェクト: connoryang/1v1dec
 def test_repr_instance(self):
     self.assertEqual(repr(C(TestClassA('something'))), "\n  <C:testfixtures.tests.sample1.TestClassA>\n  args:('something',)\n  </C>")
コード例 #14
0
ファイル: test_comparison.py プロジェクト: connoryang/1v1dec
 def test_repr_function(self):
     self.assertEqual(repr(C('testfixtures.tests.sample1.z')), '<C:testfixtures.tests.sample1.z>')
コード例 #15
0
 def test_exception(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError('foo'))
         )
コード例 #16
0
 def test_not_same_second(self):
     self.assertNotEqual(
         SampleClassA(),
         C('datetime')
         )
コード例 #17
0
 def test_exception_class_and_args(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError, args=('foo', ))
         )
コード例 #18
0
 def test_object_supplied(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA(1))
         )
コード例 #19
0
 def test_exception_not_same(self):
     self.assertNotEqual(
         ValueError('foo'),
         C(ValueError('bar'))
         )
コード例 #20
0
 def test_class_and_vars(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA, {'args': (1,)})
         )
コード例 #21
0
 def test_exception_no_args_same(self):
     self.assertEqual(
         C(WeirdException(1, 2)),
         WeirdException(1, 2)
         )
コード例 #22
0
 def test_class_and_kw(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA, args=(1,))
         )
コード例 #23
0
 def test_importerror(self):
     assert C(ImportError('x')) == ImportError('x')
コード例 #24
0
 def test_class_and_vars_and_kw(self):
     self.assertEqual(
         AClass(1, 2),
         C(AClass, {'x': 1}, y=2)
         )
コード例 #25
0
 def test_repr_module(self):
     compare_repr(C('datetime'), '<C:datetime>')
コード例 #26
0
 def test_object_and_vars(self):
     # vars passed are used instead of the object's
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA(), {'args': (1,)})
         )
コード例 #27
0
 def test_repr_function(self):
     compare_repr(C('testfixtures.tests.sample1.z'),
                  '<C:testfixtures.tests.sample1.z>')
コード例 #28
0
 def test_object_and_kw(self):
     # kws passed are used instead of the object's
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA(), args=(1,))
         )
コード例 #29
0
 def test_repr_exception(self):
     compare_repr(C(ValueError('something')),
                  ("<C:{0}.ValueError>args: ('something',)</C>"
                   ).format(exception_module))
コード例 #30
0
ファイル: test_comparison.py プロジェクト: connoryang/1v1dec
 def test_repr_module(self):
     self.assertEqual(repr(C('datetime')), '<C:datetime>')