Example #1
0
    def test_replace_checks_fields(self):
        """
        Replace will not work if the keyword is incorrect.
        """
        result = Result(None, None, None, None, None)

        with self.assertRaises(ValueError):
            result._replace(not_a_field=1)
Example #2
0
    def test_replace_checks_fields(self):
        """
        Replace will not work if the keyword is incorrect.
        """
        result = Result(None, None, None, None, None)

        with self.assertRaises(ValueError):
            result._replace(not_a_field=1)
Example #3
0
    def test_convert_to_dict(self):
        """
        Can convert to a dictionary.
        """
        result = Result(None, None, None, None, None)

        self.assertEqual(
            OrderedDict([('expectation', None), ('actual', None),
                         ('plugin', None), ('stdin', None), ('stdout', None)]),
            result._asdict())
Example #4
0
    def test_can_replace(self):
        """
        Can replace values.
        """
        result1 = Result(None, None, None, None, None)

        result2 = result1._replace(expectation=1, actual=1)

        self.assertEqual(
            'Result(expectation=1, actual=1, plugin=None, '
            'stdin=None, stdout=None)', repr(result2))
Example #5
0
    def test_can_replace(self):
        """
        Can replace values.
        """
        result1 = Result(None, None, None, None, None)

        result2 = result1._replace(expectation=1, actual=1)

        self.assertEqual(
            'Result(expectation=1, actual=1, plugin=None, '
            'stdin=None, stdout=None)',
            repr(result2))
Example #6
0
    def test_convert_to_dict(self):
        """
        Can convert to a dictionary.
        """
        result = Result(None, None, None, None, None)

        self.assertEqual(OrderedDict([
            ('expectation', None),
            ('actual', None),
            ('plugin', None),
            ('stdin', None),
            ('stdout', None)]),
            result._asdict())
Example #7
0
    def test_will_make_from_iterable(self):
        """
        Class method can create new results.
        """
        result = Result._make((None, None, None, None, None))

        self.assertEqual(
            'Result(expectation=None, actual=None, plugin=None, '
            'stdin=None, stdout=None)', repr(result))
Example #8
0
    def test_can_copy(self):
        """
        Can copy.
        """
        result1 = Result(None, None, None, None, None)

        result2 = copy(result1)

        self.assertTrue(result1 == result2)
        self.assertFalse(result1 is result2)
Example #9
0
    def test_will_make_from_iterable(self):
        """
        Class method can create new results.
        """
        result = Result._make((None, None, None, None, None))

        self.assertEqual(
            'Result(expectation=None, actual=None, plugin=None, '
            'stdin=None, stdout=None)',
            repr(result))
Example #10
0
 def test_requires_correct_args(self):
     """
     TypeError if missing arguments.
     """
     with self.assertRaises(TypeError):
         Result._make(tuple())
Example #11
0
 def test_requires_correct_args(self):
     """
     TypeError if missing arguments.
     """
     with self.assertRaises(TypeError):
         Result._make(tuple())