Did I find the right examples for you? yes no

All Samples(283)  |  Call(283)  |  Derive(0)  |  Import(0)
Assert that needle is in haystack.

src/t/e/testtools-0.9.35/testtools/tests/test_testcase.py   testtools(Download)
    def test_assertIn_success(self):
        # assertIn(needle, haystack) asserts that 'needle' is in 'haystack'.
        self.assertIn(3, range(10))
        self.assertIn('foo', 'foo bar baz')
        self.assertIn('foo', 'foo bar baz'.split())

src/t/r/trove-HEAD/trove/tests/unittests/mysql/test_user_controller.py   trove(Download)
        error_paths = [error.path.pop() for error in errors]
        self.assertThat(len(errors), Is(2))
        self.assertIn("'' is too short", error_messages)
        self.assertIn("'' does not match '^.*[0-9a-zA-Z]+.*$'", error_messages)
        self.assertIn("password", error_paths)
        error_messages = [error.message for error in errors]
        self.assertThat(len(errors), Is(1))
        self.assertIn("'password' is a required property", error_messages)
 
    def test_validate_create_short_name(self):
        error_paths = [error.path.pop() for error in errors]
        self.assertThat(len(errors), Is(3))
        self.assertIn("'password' is a required property", error_messages)
        self.assertIn("'' is too short", error_messages)
        self.assertIn("'' does not match '^.*[0-9a-zA-Z]+.*$'", error_messages)

src/o/s/os-collect-config-0.1.17/os_collect_config/tests/test_collect.py   os-collect-config(Download)
                    keys_found.update(set(contents.keys()))
            # From test_ec2.FakeRequests
            self.assertIn("local-ipv4", keys_found)
            self.assertIn("reservation-id", keys_found)
            # From test_cfn.FakeRequests
            self.assertIn("int1", keys_found)
            self.assertIn("map_ab", keys_found)
        ]
        calls = self._fake_popen_call_main(occ_args)
        self.assertIn('OS_CONFIG_FILES', calls[0]['env'])
        cfg.CONF.reset()
        # First time caches data, run again, make sure we run command again

src/z/u/zuul-HEAD/tests/test_scheduler.py   zuul(Download)
        self.assertEqual(len(A.messages), 2)
        if 'dup1/project-test1' in A.messages[0]:
            self.assertIn('dup1/project-test1', A.messages[0])
            self.assertNotIn('dup2/project-test1', A.messages[0])
            self.assertNotIn('dup1/project-test1', A.messages[1])
            self.assertIn('dup2/project-test1', A.messages[1])
        else:
            self.assertIn('dup1/project-test1', A.messages[1])
            self.assertNotIn('dup2/project-test1', A.messages[1])
            self.assertNotIn('dup1/project-test1', A.messages[0])
            self.assertIn('dup2/project-test1', A.messages[0])
 
    def test_parallel_changes(self):
        job_names = [x.name for x in self.history]
        self.assertEqual(len(self.history), 1)
        self.assertIn('project-post', job_names)
 
    def test_build_configuration_branch(self):

src/t/e/testtools-0.9.35/testtools/tests/test_testresult.py   testtools(Download)
    def test_non_ascii_failure_string(self):
        """Assertion contents can be non-ascii and should get decoded"""
        text, raw = self._get_sample_text(_get_exception_encoding())
        textoutput = self._test_external_case("self.fail(%s)" % _r(raw))
        self.assertIn(self._as_output(text), textoutput)
        textoutput = self._test_external_case(
            testline='exec ("self.fail(%s)")' % _r(raw))
        self.assertIn(self._as_output(text), textoutput)
 
    def test_control_characters_in_failure_string(self):
        """Control characters in assertions should be escaped"""
        textoutput = self._test_external_case("self.fail('\\a\\a\\a')")
        self.expectFailure("Defense against the beeping horror unimplemented",
            self.assertNotIn, self._as_output("\a\a\a"), textoutput)
        self.assertIn(self._as_output(_u("\uFFFD\uFFFD\uFFFD")), textoutput)
            output_text = example_text.encode("shift_jis").decode(
                _get_exception_encoding(), "replace")
        self.assertIn(self._as_output("AssertionError: %s" % output_text),
            textoutput)
 
            coding="iso2022_jp",
            testline="self.fail('Simple') # %s" % example_text)
        self.assertIn(self._as_output(example_text), textoutput)
 
    def test_unicode_exception(self):

src/t/e/testtools-HEAD/testtools/tests/test_testcase.py   testtools(Download)
    def test_assertIn_success(self):
        # assertIn(needle, haystack) asserts that 'needle' is in 'haystack'.
        self.assertIn(3, range(10))
        self.assertIn('foo', 'foo bar baz')
        self.assertIn('foo', 'foo bar baz'.split())

src/z/u/zuul-2.0.0/tests/test_scheduler.py   zuul(Download)
        self.assertEqual(len(A.messages), 2)
        if 'dup1/project-test1' in A.messages[0]:
            self.assertIn('dup1/project-test1', A.messages[0])
            self.assertNotIn('dup2/project-test1', A.messages[0])
            self.assertNotIn('dup1/project-test1', A.messages[1])
            self.assertIn('dup2/project-test1', A.messages[1])
        else:
            self.assertIn('dup1/project-test1', A.messages[1])
            self.assertNotIn('dup2/project-test1', A.messages[1])
            self.assertNotIn('dup1/project-test1', A.messages[0])
            self.assertIn('dup2/project-test1', A.messages[0])
 
    def test_parallel_changes(self):
        job_names = [x.name for x in self.history]
        self.assertEqual(len(self.history), 1)
        self.assertIn('project-post', job_names)
 
    def test_build_configuration_branch(self):

src/t/e/testtools-HEAD/testtools/tests/test_testresult.py   testtools(Download)
    def test_non_ascii_failure_string(self):
        """Assertion contents can be non-ascii and should get decoded"""
        text, raw = self._get_sample_text(_get_exception_encoding())
        textoutput = self._test_external_case("self.fail(%s)" % _r(raw))
        self.assertIn(self._as_output(text), textoutput)
        textoutput = self._test_external_case(
            testline='exec ("self.fail(%s)")' % _r(raw))
        self.assertIn(self._as_output(text), textoutput)
 
    def test_control_characters_in_failure_string(self):
        """Control characters in assertions should be escaped"""
        textoutput = self._test_external_case("self.fail('\\a\\a\\a')")
        self.expectFailure("Defense against the beeping horror unimplemented",
            self.assertNotIn, self._as_output("\a\a\a"), textoutput)
        self.assertIn(self._as_output(_u("\uFFFD\uFFFD\uFFFD")), textoutput)
            output_text = example_text.encode("shift_jis").decode(
                _get_exception_encoding(), "replace")
        self.assertIn(self._as_output("AssertionError: %s" % output_text),
            textoutput)
 
            coding="iso2022_jp",
            testline="self.fail('Simple') # %s" % example_text)
        self.assertIn(self._as_output(example_text), textoutput)
 
    def test_unicode_exception(self):

src/h/e/heat-HEAD/heat/tests/test_parameters.py   heat(Download)
        err = self.assertRaises(constr.InvalidSchemaError,
                                self.new_parameter, 'p', schema, 'foo')
        self.assertIn('wibble', str(err))
 
    def test_no_echo_true(self):
        err = self.assertRaises(exception.StackValidationFailed,
                                self.new_parameter, 'p', schema, 'foo')
        self.assertIn('wibble', str(err))
 
    def test_string_overflow(self):
        err = self.assertRaises(exception.StackValidationFailed,
                                self.new_parameter, 'p', schema, 'foo')
        self.assertIn('wibble', str(err))
 
    def test_string_pattern_good(self):
        err = self.assertRaises(exception.StackValidationFailed,
                                self.new_parameter, 'p', schema, '1foo')
        self.assertIn('wibble', str(err))
 
    def test_string_pattern_bad_suffix(self):
        err = self.assertRaises(exception.StackValidationFailed,
                                self.new_parameter, 'p', schema, 'foo1')
        self.assertIn('wibble', str(err))
 
    def test_string_value_list_good(self):

src/y/c/yconf-0.3.2/yconf/tests/test_util.py   yconf(Download)
 
        for k, v in nd.items():
            self.assertIn(k, self.data)
            self.assertEqual(self.data[k], v)
 
    def test_in(self):
 
        nd = NestedDict(self.data)
        self.assertIn("a", nd)
        self.assertNotIn("g", nd)
    def test_delete(self):
 
        nd = NestedDict(self.data)
 
        self.assertIn("b", nd["a"])
        delattr(nd["a"], "b")
        self.assertNotIn("b", nd["a"])
 
        self.assertIn("e", nd["a"])
        self.assertNotIn("e", nd["a"])
 
        self.assertIn("a", nd)
        nd.delete("a")
        self.assertNotIn("a", nd)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8  Next