Exemplo n.º 1
0
 def test_repr_class(self):
     self.assertEqual(repr(C('testfixtures.tests.sample1.TestClassA')), '<C:testfixtures.tests.sample1.TestClassA>')
Exemplo n.º 2
0
 def test_repr_class(self):
     compare_repr(C('testfixtures.tests.sample1.SampleClassA'),
                  '<C:testfixtures.tests.sample1.SampleClassA>')
Exemplo n.º 3
0
 def test_repr_instance(self):
     compare_repr(
         C(SampleClassA('something')),
         "<C:testfixtures.tests.sample1.SampleClassA>"
         "args: ('something',)"
         "</C>")
Exemplo n.º 4
0
 def test_no___dict___partial_same(self):
     x = X()
     x.x = 1
     self.assertEqual(C(X, x=1, partial=True), x)
Exemplo n.º 5
0
 def test_class_defines_comparison_strictly(self):
     self.assertEqual(
         C('testfixtures.tests.test_comparison.FussyDefineComparison',
           attr=1),
         FussyDefineComparison(1)
         )
Exemplo n.º 6
0
 def test_exception_instance_and_args(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError('bar'), args=('foo', ))
         )
Exemplo n.º 7
0
 def test_exception_no_args_different(self):
     self.assertNotEqual(
         WeirdException(1, 2),
         C(WeirdException(1, 3))
         )
Exemplo n.º 8
0
 def test_second(self):
     self.assertEqual(
         SampleClassA(),
         C('testfixtures.tests.sample1.SampleClassA'),
         )
Exemplo n.º 9
0
 def test_not_same_first(self):
     self.assertNotEqual(
         C('datetime'),
         SampleClassA()
         )
Exemplo n.º 10
0
 def test_repr_class_and_vars(self):
     compare_repr(
         C(SampleClassA, {'args': (1,)}),
         "<C:testfixtures.tests.sample1.SampleClassA>args: (1,)</C>"
     )
Exemplo n.º 11
0
 def test_first(self):
     self.assertEqual(
         C('testfixtures.tests.sample1.SampleClassA'),
         SampleClassA()
         )
Exemplo n.º 12
0
 def test_repr_exception(self):
     self.assertEqual(repr(C(ValueError('something'))), "\n  <C:{0}.ValueError>\n  args:('something',)\n  </C>".format(exception_module))
Exemplo n.º 13
0
 def test_repr_instance(self):
     self.assertEqual(repr(C(TestClassA('something'))), "\n  <C:testfixtures.tests.sample1.TestClassA>\n  args:('something',)\n  </C>")
Exemplo n.º 14
0
 def test_repr_function(self):
     self.assertEqual(repr(C('testfixtures.tests.sample1.z')), '<C:testfixtures.tests.sample1.z>')
Exemplo n.º 15
0
 def test_exception(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError('foo'))
         )
Exemplo n.º 16
0
 def test_not_same_second(self):
     self.assertNotEqual(
         SampleClassA(),
         C('datetime')
         )
Exemplo n.º 17
0
 def test_exception_class_and_args(self):
     self.assertEqual(
         ValueError('foo'),
         C(ValueError, args=('foo', ))
         )
Exemplo n.º 18
0
 def test_object_supplied(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA(1))
         )
Exemplo n.º 19
0
 def test_exception_not_same(self):
     self.assertNotEqual(
         ValueError('foo'),
         C(ValueError('bar'))
         )
Exemplo n.º 20
0
 def test_class_and_vars(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA, {'args': (1,)})
         )
Exemplo n.º 21
0
 def test_exception_no_args_same(self):
     self.assertEqual(
         C(WeirdException(1, 2)),
         WeirdException(1, 2)
         )
Exemplo n.º 22
0
 def test_class_and_kw(self):
     self.assertEqual(
         SampleClassA(1),
         C(SampleClassA, args=(1,))
         )
Exemplo n.º 23
0
 def test_importerror(self):
     assert C(ImportError('x')) == ImportError('x')
Exemplo n.º 24
0
 def test_class_and_vars_and_kw(self):
     self.assertEqual(
         AClass(1, 2),
         C(AClass, {'x': 1}, y=2)
         )
Exemplo n.º 25
0
 def test_repr_module(self):
     compare_repr(C('datetime'), '<C:datetime>')
Exemplo n.º 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,)})
         )
Exemplo n.º 27
0
 def test_repr_function(self):
     compare_repr(C('testfixtures.tests.sample1.z'),
                  '<C:testfixtures.tests.sample1.z>')
Exemplo n.º 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,))
         )
Exemplo n.º 29
0
 def test_repr_exception(self):
     compare_repr(C(ValueError('something')),
                  ("<C:{0}.ValueError>args: ('something',)</C>"
                   ).format(exception_module))
Exemplo n.º 30
0
 def test_repr_module(self):
     self.assertEqual(repr(C('datetime')), '<C:datetime>')