Did I find the right examples for you? yes no

All Samples(309)  |  Call(309)  |  Derive(0)  |  Import(0)
Get a string unique to this test.

Returns a string that is guaranteed to be unique to this instance. Use
this when you need an arbitrary string in your test, or as a helper
for custom anonymous factory methods.

:param prefix: The prefix of the string. If not provided, defaults
    to the id of the tests.
:return: A bytestring of '<prefix>-<unique_int>'.

src/t/e/testtools-0.9.35/testtools/tests/test_testcase.py   testtools(Download)
    def test_getUniqueString(self):
        # getUniqueString returns the current test id followed by a unique
        # integer.
        name_one = self.getUniqueString()
        self.assertEqual('%s-%d' % (self.id(), 1), name_one)
        name_two = self.getUniqueString()
    def test_getUniqueString_prefix(self):
        # If getUniqueString is given an argument, it uses that argument as
        # the prefix of the unique string, rather than the test id.
        name_one = self.getUniqueString('foo')
        self.assertThat(name_one, Equals('foo-1'))
        name_two = self.getUniqueString('bar')
        test = FooTestCase('test_foo')
        oldName = test.id()
        newName = self.getUniqueString()
        newTest = clone_test_with_new_id(test, newName)
        self.assertEqual(newName, newTest.id())

src/t/e/testtools-HEAD/testtools/tests/test_testcase.py   testtools(Download)
    def test_getUniqueString(self):
        # getUniqueString returns the current test id followed by a unique
        # integer.
        name_one = self.getUniqueString()
        self.assertEqual('%s-%d' % (self.id(), 1), name_one)
        name_two = self.getUniqueString()
    def test_getUniqueString_prefix(self):
        # If getUniqueString is given an argument, it uses that argument as
        # the prefix of the unique string, rather than the test id.
        name_one = self.getUniqueString('foo')
        self.assertThat(name_one, Equals('foo-1'))
        name_two = self.getUniqueString('bar')
        test = FooTestCase('test_foo')
        oldName = test.id()
        newName = self.getUniqueString()
        newTest = clone_test_with_new_id(test, newName)
        self.assertEqual(newName, newTest.id())

src/p/k/pkgme-0.4.3/pkgme/tests/test_backend.py   pkgme(Download)
    def test_describe(self):
        # The default describe() just returns the name.
        backend = Backend(self.getUniqueString())
        self.assertEqual(backend.name, backend.describe())
 
    def test_describe(self):
        backend = ExternalHelpersBackend(
            self.getUniqueString(), self.getUniqueString())
        self.assertEqual(
            "%s (%s)" % (backend.name, backend.basepath), backend.describe())
 
    def test_want_runs_script(self):
        script = "#!/bin/sh\necho 10\n"
        tempdir = self.make_want_script(script)
        backend = ExternalHelpersBackend(self.getUniqueString(), tempdir.path)
    def test_empty_want_script(self):
        script = "#!/bin/sh\n"
        tempdir = self.make_want_script(script)
        backend = ExternalHelpersBackend(self.getUniqueString(), tempdir.path)
        e = self.assertRaises(WantError, backend.want, tempdir.path)

src/p/k/pkgme-devportal-0.5.1/devportalbinary/tests/test_metadata.py   pkgme-devportal(Download)
    def test_load_json_all_fields(self):
        metadata = {
            'foo': self.getUniqueString(),
            'bar': self.getUniqueInteger(),
            }
    def test_makes_desktop_file_with_given_values(self):
        package_name = self.getUniqueString()
        executable = self.getUniqueString()
        app_name = self.getUniqueString()
        tagline = self.getUniqueString()

src/t/i/timeline_django-0.0.2/timeline_django/tests/test_timeline_cursor.py   timeline_django(Download)
            inner_cursor = TestCursor()
        if alias is None:
            alias = self.getUniqueString()
        if db is None:
            db = TestDatabase(alias, inner_cursor, self.getUniqueString())
        if timeline_factory is None:
            timeline = Timeline()
            timeline_factory = lambda: timeline
        if prefix is self._not_passed:
            prefix = self.getUniqueString()
                timeline_factory=lambda: None)
        sql = 'SELECT * from foo;'
        params = (self.getUniqueString(),)
        # Shouldn't crash trying to use the None returned from the
        # timeline_factory
    def test_execute_creates_action(self):
        timeline = Timeline()
        cursor = self.get_cursor(timeline_factory=lambda: timeline)
        cursor.execute(self.getUniqueString())
        self.assertEqual(1, len(timeline.actions))

src/o/o/oops_dictconfig-0.0.5/oops_dictconfig/tests/test_dictconfig.py   oops_dictconfig(Download)
    def test_datedir_gives_datedir_publisher(self):
        publisher_defn = dict(type='datedir', error_dir=self.getUniqueString())
        config = self.get_config_from_dict([publisher_defn])
        self.assertEqual(1, len(config.publishers))
        self.assertIsInstance(config.publishers[0].im_self, DateDirRepo)
 
    def test_datedir_sets_error_dir_on_repo(self):
        error_dir = self.getUniqueString()
    def test_datedir_sets_inherit_id_on_repo(self):
        inherit_id = True
        publisher_defn = dict(type='datedir', error_dir=self.getUniqueString(),
                inherit_id=inherit_id)
        config = self.get_config_from_dict([publisher_defn])
        self.assertEquals(inherit_id, config.publishers[0].im_self.inherit_id)
 
    def test_datedir_sets_stash_path_on_repo(self):
        stash_path = True
        publisher_defn = dict(type='datedir', error_dir=self.getUniqueString(),
    def test_datedir_wraps_if_new_only(self):
        """If new_only is set in the definition then the publisher method is wrapped."""
        publisher_defn = dict(type='datedir', error_dir=self.getUniqueString(),
                new_only=True)
        config = self.get_config_from_dict([publisher_defn])

src/p/k/pkgme-0.4.3/pkgme/tests/test_project_info.py   pkgme(Download)
    def test_get_one(self):
        key = self.getUniqueString()
        value = self.getUniqueString()
        info = DictInfo({key: value})
        self.assertEqual({key: value}, info.get_all([key]))
 
    def test_get_multiple(self):
        key1 = self.getUniqueString()
        value1 = self.getUniqueString()
        key2 = self.getUniqueString()

src/p/k/pkgme-0.4.3/pkgme/tests/test_write.py   pkgme(Download)
    def test_write_creates_target_dir(self):
        writer = self.get_writer()
        tempdir = self.useFixture(TempDir())
        target_dir = abspath(tempdir, self.getUniqueString())
        writer.write(
            [SimplePackageFile(self.getUniqueString())], target_dir)
    def test_write_creates_needed_subdirs(self):
        writer = self.get_writer()
        tempdir = self.useFixture(TempDir())
        subdir = self.getUniqueString()
        package_file = SimplePackageFile(
            os.path.join(subdir, self.getUniqueString()))
    def test_write_accepts_existing_subdir(self):
        writer = self.get_writer()
        tempdir = self.useFixture(TempDir())
        subdir = self.getUniqueString()
        package_file = SimplePackageFile(

src/p/k/pkgme-devportal-0.5.1/devportalbinary/tests/test_utils.py   pkgme-devportal(Download)
    def assertIsWriteable(self, fd, path):
        contents = self.getUniqueString()
        os.write(fd, contents)
        os.close(fd)
        self.assertThat(path, FileContains(contents))
    def test_saves_file(self):
        contents = self.getUniqueString()
        def urlopen(url):
            return StringIO(contents)
        self.patch(utils, 'urlopen', urlopen)
    def test_filename(self):
        filename = self.getUniqueString()
        self.assertEqual(filename, utils.first_path_component(filename))
 
    def test_directory(self):
        filename = self.getUniqueString()
        directory = self.getUniqueString()

src/p/k/pkgme-0.4.3/pkgme/tests/test_api.py   pkgme(Download)
    def make_info(self, name):
        info = DictInfo(
            {
                PackageName.name: name,
                Maintainer.name: self.getUniqueString(),
                Architecture.name: "all",
                Description.name: self.getUniqueString(),
    def test_write_packaging(self):
        name = PackageName.clean(self.getUniqueString())
        info = self.make_info(name)
        tempdir = self.useFixture(TempDir()).path
        backend = StaticBackend(
            self.getUniqueString(), 10, info, expected_path=tempdir)
    def test_write_packaging_passes_allowed_backend_names(self):
        name = PackageName.clean(self.getUniqueString())
        other_name = name + "WRONG"
        info1 = self.make_info(name)
        info2 = self.make_info(other_name)

  1 | 2 | 3 | 4  Next