PageRenderTime 820ms queryTime 298ms sortTime 19ms getByIdsTime 78ms findMatchingLines 193ms

100+ results results for '"import unittest" unittest.TestCase self.assert lang:Python' (820 ms)

Not the results you expected?
test_registrar.py https://gitlab.com/noc0lour/mailman | Python | 268 lines
                    
19
                    
20import unittest
                    
21
                    
21
                    
22from mailman.app.lifecycle import create_list
                    
23from mailman.interfaces.mailinglist import SubscriptionPolicy
                    
23from mailman.interfaces.mailinglist import SubscriptionPolicy
                    
24from mailman.interfaces.member import MemberRole
                    
25from mailman.interfaces.pending import IPendings
                    
25from mailman.interfaces.pending import IPendings
                    
26from mailman.interfaces.registrar import IRegistrar
                    
27from mailman.interfaces.subscriptions import TokenOwner
                    
34
                    
35class TestRegistrar(unittest.TestCase):
                    
36    """Test registration."""
                    
                
test_long_future.py https://gitlab.com/envieidoc/Clover | Python | 221 lines
                    
6import sys
                    
7import random
                    
8import math
                    
8import math
                    
9import unittest
                    
10from test.test_support import run_unittest
                    
52
                    
53class TrueDivisionTests(unittest.TestCase):
                    
54    def test(self):
                    
60        self.assertEqual(mhuge / huge, -1.0)
                    
61        self.assertEqual(1 / huge, 0.0)
                    
62        self.assertEqual(1L / huge, 0.0)
                    
62        self.assertEqual(1L / huge, 0.0)
                    
63        self.assertEqual(1 / mhuge, 0.0)
                    
64        self.assertEqual(1L / mhuge, 0.0)
                    
                
executive_unittest.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 201 lines
                    
33import sys
                    
34import unittest
                    
35
                    
40
                    
41class ScriptErrorTest(unittest.TestCase):
                    
42    def test_string_from_args(self):
                    
66
                    
67class ExecutiveTest(unittest.TestCase):
                    
68
                    
87        self.assert_interpreter_for_content('perl', '#!/usr/bin/perl')
                    
88        self.assert_interpreter_for_content('perl', '#!/usr/bin/perl -w')
                    
89        self.assert_interpreter_for_content(sys.executable, '#!/usr/bin/env python')
                    
198        executive = Executive()
                    
199        self.assertTrue(executive.check_running_pid(os.getpid()))
                    
200        # Maximum pid number on Linux is 32768 by default
                    
                
layouttest_analyzer_helpers_unittest.py https://gitlab.com/f3822/qtwebengine-chromium | Python | 212 lines
                    
10import time
                    
11import unittest
                    
12
                    
13
                    
14import layouttest_analyzer_helpers
                    
15
                    
16
                    
17class TestLayoutTestAnalyzerHelpers(unittest.TestCase):
                    
18
                    
84                      'media/track/track-webvtt-tc004-magicheader.html')
                    
85    self.assertEquals(diff['whole'][0][0][0],
                    
86                      'media/video-source-type.html')
                    
91    self.assertEquals(diff['whole'][1][0][0], 'add1.html')
                    
92    self.assertEquals(diff['skip'][1][0][0], 'add2.html')
                    
93
                    
                
test_variables.py https://gitlab.com/abhi1tb/build | Python | 310 lines
                    
1import unittest
                    
2import gc
                    
2import gc
                    
3from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
                    
4                     TclError)
                    
16
                    
17class TestBase(unittest.TestCase):
                    
18
                    
32        v = Variable(self.root)
                    
33        self.assertEqual("", v.get())
                    
34        self.assertRegex(str(v), r"^PY_VAR(\d+)$")
                    
37        v = Variable(self.root, "sample string", "varname")
                    
38        self.assertEqual("sample string", v.get())
                    
39        self.assertEqual("varname", str(v))
                    
308if __name__ == "__main__":
                    
309    from test.support import run_unittest
                    
310    run_unittest(*tests_gui)
                    
                
test_dtoc.py https://gitlab.com/jiangming1399/u-boot | Python | 523 lines
                    
14import struct
                    
15import unittest
                    
16
                    
17import dtb_platdata
                    
18from dtb_platdata import conv_name_to_c
                    
19from dtb_platdata import get_compat_name
                    
61
                    
62class TestDtoc(unittest.TestCase):
                    
63    """Tests for dtoc"""
                    
90        """Test operation of get_value() function"""
                    
91        self.assertEqual('0x45',
                    
92                         get_value(fdt.TYPE_INT, struct.pack('>I', 0x45)))
                    
92                         get_value(fdt.TYPE_INT, struct.pack('>I', 0x45)))
                    
93        self.assertEqual('0x45',
                    
94                         get_value(fdt.TYPE_BYTE, struct.pack('<I', 0x45)))
                    
                
PRESUBMIT_test.py https://github.com/chromium/chromium.git | Python | 231 lines
                    
7import sys
                    
8import unittest
                    
9
                    
16
                    
17class CheckNotificationConstructors(unittest.TestCase):
                    
18  """Test the _CheckNotificationConstructors presubmit check."""
                    
59
                    
60class CheckAlertDialogBuilder(unittest.TestCase):
                    
61  """Test the _CheckAlertDialogBuilder presubmit check."""
                    
125
                    
126class CheckCompatibleAlertDialogBuilder(unittest.TestCase):
                    
127  """Test the _CheckCompatibleAlertDialogBuilder presubmit check."""
                    
178
                    
179class CheckBundleUtilsIdentifierName(unittest.TestCase):
                    
180  """Test the _CheckBundleUtilsIdentifierName presubmit check."""
                    
                
test_languages.py https://gitlab.com/Smileyt/KomodoEdit | Python | 275 lines
                    
3
                    
4import unittest
                    
5
                    
5
                    
6from xpcom import components
                    
7from xpcom.server import UnwrapObject
                    
8
                    
9from testlib import tag
                    
10
                    
10
                    
11class koLanguageSvcTestCase(unittest.TestCase):
                    
12    """Base class for koIDocument test cases."""
                    
222            elif issubclass(vars, Exception):
                    
223                self.assertRaises(ValueError, self.langRegistrySvcUnwrapped._getEmacsLocalVariables,
                    
224                                  head, tail)
                    
                
tests.py https://github.com/akaariai/django-old.git | Python | 349 lines
                    
1import copy
                    
2import pickle
                    
3
                    
4from django.http import (QueryDict, HttpResponse, SimpleCookie, BadHeaderError,
                    
5        parse_cookie)
                    
5        parse_cookie)
                    
6from django.utils import unittest
                    
7
                    
8
                    
9class QueryDictTests(unittest.TestCase):
                    
10    def test_missing_key(self):
                    
211
                    
212class HttpResponseTests(unittest.TestCase):
                    
213    def test_unicode_headers(self):
                    
298
                    
299class CookieTests(unittest.TestCase):
                    
300    def test_encode(self):
                    
                
test_recipients.py https://gitlab.com/noc0lour/mailman | Python | 202 lines
                    
19
                    
20import unittest
                    
21
                    
27    configuration, specialized_message_from_string as mfs)
                    
28from mailman.testing.layers import ConfigLayer
                    
29from zope.component import getUtility
                    
31
                    
32class TestMemberRecipients(unittest.TestCase):
                    
33    """Test regular member recipient calculation."""
                    
82
                    
83class TestOwnerRecipients(unittest.TestCase):
                    
84    """Test owner recipient calculation."""
                    
118        self._process(self._mlist, self._msg, msgdata)
                    
119        self.assertEqual(msgdata['recipients'], set(('cris@example.com',
                    
120                                                     'dave@example.com')))
                    
                
test_steps_master.py https://gitlab.com/murder187ss/buildbot | Python | 239 lines
                    
20from twisted.internet import reactor
                    
21from twisted.python import failure
                    
22from twisted.python import runtime
                    
22from twisted.python import runtime
                    
23from twisted.trial import unittest
                    
24
                    
36
                    
37class TestMasterShellCommand(steps.BuildStepMixin, unittest.TestCase):
                    
38
                    
207
                    
208class TestSetProperty(steps.BuildStepMixin, unittest.TestCase):
                    
209
                    
224
                    
225class TestLogRenderable(steps.BuildStepMixin, unittest.TestCase):
                    
226
                    
                
test_events.py https://gitlab.com/goolic/pyramid | Python | 301 lines
                    
1import unittest
                    
2from pyramid import testing
                    
3
                    
4class NewRequestEventTests(unittest.TestCase):
                    
5    def _getTargetClass(self):
                    
29
                    
30class NewResponseEventTests(unittest.TestCase):
                    
31    def _getTargetClass(self):
                    
91
                    
92class ContextFoundEventTests(unittest.TestCase):
                    
93    def _getTargetClass(self):
                    
126
                    
127class TestSubscriber(unittest.TestCase):
                    
128    def setUp(self):
                    
202
                    
203class TestBeforeRender(unittest.TestCase):
                    
204    def _makeOne(self, system, val=None):
                    
                
test_heapq.py https://github.com/jwal/python-tutorial.git | Python | 286 lines
                    
4import random
                    
5import unittest
                    
6from test import test_support
                    
6from test import test_support
                    
7import sys
                    
8
                    
17
                    
18class TestHeap(unittest.TestCase):
                    
19
                    
118                self.assertEqual(nlargest(n, data), sorted(data, reverse=True)[:n])
                    
119                self.assertEqual(nlargest(n, data, key=f),
                    
120                                 sorted(data, key=f, reverse=True)[:n])
                    
216
                    
217class TestErrorHandling(unittest.TestCase):
                    
218
                    
                
test_genericpath.py https://gitlab.com/envieidoc/Clover | Python | 256 lines
                    
4
                    
5import unittest
                    
6from test import test_support
                    
6from test import test_support
                    
7import os
                    
8import genericpath
                    
8import genericpath
                    
9import sys
                    
10
                    
18
                    
19class GenericTest(unittest.TestCase):
                    
20    # The path module to be tested
                    
27        for attr in self.common_attributes + self.attributes:
                    
28            with self.assertRaises(TypeError):
                    
29                getattr(self.pathmodule, attr)()
                    
                
test_traceback.py https://gitlab.com/envieidoc/Clover | Python | 204 lines
                    
5import sys
                    
6import unittest
                    
7from imp import reload
                    
7from imp import reload
                    
8from test.test_support import run_unittest, is_jython, Error
                    
9
                    
12
                    
13class TracebackCases(unittest.TestCase):
                    
14    # For now, a very minimal set of tests.  I want to be sure that
                    
65        self.assertTrue(err[1].strip() == "print 2")
                    
66        self.assertIn("^", err[2])
                    
67        self.assertTrue(err[1].find("2") == err[2].find("^"))
                    
171
                    
172class TracebackFormatTests(unittest.TestCase):
                    
173
                    
                
tests.py https://bitbucket.org/pcelta/python-django.git | Python | 286 lines
                    
1from __future__ import absolute_import
                    
2
                    
2
                    
3from datetime import datetime
                    
4
                    
4
                    
5from django.conf import settings
                    
6from django.contrib import admin
                    
6from django.contrib import admin
                    
7from django.contrib.admin import helpers
                    
8from django.contrib.admin.util import (display_for_field, label_for_field,
                    
14from django.test import TestCase
                    
15from django.utils import unittest
                    
16from django.utils.formats import localize
                    
72
                    
73class UtilTests(unittest.TestCase):
                    
74    def test_values_from_lookup_field(self):
                    
                
test_platform.py https://gitlab.com/pmuontains/Odoo | Python | 267 lines
                    
2import os
                    
3import unittest
                    
4import platform
                    
4import platform
                    
5import subprocess
                    
6
                    
8
                    
9class PlatformTest(unittest.TestCase):
                    
10    def test_architecture(self):
                    
140        res = platform.uname()
                    
141        self.assertTrue(any(res))
                    
142
                    
233    def test_libc_ver(self):
                    
234        import os
                    
235        if os.path.isdir(sys.executable) and \
                    
                
test_request_pool.py https://gitlab.com/gbozee/api-gateway-client | Python | 270 lines
                    
1# from . import unittest
                    
2# from . import mock
                    
164
                    
165#         self.assertEqual(self.service.client, self.schema)
                    
166
                    
182#         self.assertEqual(self.service.fields, self.fields)
                    
183#         self.assertEqual(result[0]['req_id'], 28)
                    
184
                    
190#         self.assertEqual(result['pk'], 23)
                    
191#         self.assertEqual(result['tutor_slug'], "johndoe")
                    
192
                    
212
                    
213# class LocalMatchingServiceTestCase(BaseTestCase, unittest.TestCase):
                    
214#     def setUp(self):
                    
224
                    
225# class RemoteMatchingServiceTestCase(BaseTestCase, unittest.TestCase):
                    
226#     def setUp(self):
                    
                
test_module_validate.py https://gitlab.com/exarh-team/skaro-server | Python | 432 lines
                    
19
                    
20import unittest
                    
21from modules import validate
                    
24
                    
25class ValidateTestCase(unittest.TestCase):
                    
26
                    
27    def test_is_valid(self):
                    
28        self.assertTrue(
                    
29            validate.is_valid("login", validate.P_LOGIN)
                    
60
                    
61        self.assertTrue(
                    
62            validate.is_valid("200 OK", validate.P_STATUS)
                    
371        def test_exception_dict(a, info=False):
                    
372            self.assertCountEqual(
                    
373                info,
                    
                
test_commands.py https://gitlab.com/github-cloud-corp/aws-cli | Python | 238 lines
                    
16import mock
                    
17import unittest
                    
18
                    
20
                    
21from awscli.customizations.datapipeline import convert_described_objects
                    
22from awscli.customizations.datapipeline import ListRunsCommand
                    
141
                    
142class TestConvertObjects(unittest.TestCase):
                    
143
                    
147        # This comes from a "refValue" value.
                    
148        self.assertEqual(converted[0]['@componentParent'], 'S3Input')
                    
149        # Should also merge in @id and name.
                    
152        # This comes from a "stringValue" value.
                    
153        self.assertEqual(converted[0]['@sphere'], "INSTANCE")
                    
154
                    
                
test_notifications.py https://gitlab.com/mmhat/mailman | Python | 317 lines
                    
21import os
                    
22import unittest
                    
23
                    
26from mailman.config import config
                    
27from mailman.interfaces.languages import ILanguageManager
                    
28from mailman.interfaces.member import MemberRole
                    
39
                    
40class TestNotifications(unittest.TestCase):
                    
41    """Test notifications."""
                    
124        message = items[0].msg
                    
125        self.assertEqual(str(message['subject']),
                    
126                         'Welcome to the "Test List" mailing list')
                    
126                         'Welcome to the "Test List" mailing list')
                    
127        self.assertMultiLineEqual(
                    
128            message.get_payload(),
                    
                
test_bus.py https://gitlab.com/gregtyka/frankenserver | Python | 263 lines
                    
2import time
                    
3import unittest
                    
4
                    
6from cherrypy._cpcompat import get_daemon, set
                    
7from cherrypy.process import wspbus
                    
8
                    
12
                    
13class PublishSubscribeTests(unittest.TestCase):
                    
14
                    
72
                    
73class BusMethodTests(unittest.TestCase):
                    
74
                    
123        # The stop method MUST call all 'stop' listeners.
                    
124        self.assertEqual(set(self.responses),
                    
125                         set([msg % (i, 'stop', None) for i in range(num)]))
                    
                
test_bool.py https://gitlab.com/envieidoc/Clover | Python | 371 lines
                    
2
                    
3import unittest
                    
4from test import test_support
                    
5
                    
6import os
                    
7
                    
7
                    
8class BoolTest(unittest.TestCase):
                    
9
                    
18
                    
19        self.assertRaises(TypeError, int.__new__, bool, 0)
                    
20
                    
26            fo = open(test_support.TESTFN, "rb")
                    
27            self.assertEqual(fo.read(), 'False True\n')
                    
28        finally:
                    
                
lang.py https://github.com/dax/jmc.git | Python | 219 lines
                    
23
                    
24import unittest
                    
25
                    
25
                    
26import jcl.tests.lang
                    
27
                    
27
                    
28import jmc.lang
                    
29from jmc.lang import Lang
                    
30
                    
31from pyxmpp.iq import Iq
                    
32
                    
32
                    
33class Lang_TestCase(unittest.TestCase):
                    
34    def setUp(self):
                    
                
test_steps_shellsequence.py https://gitlab.com/murder187ss/buildbot | Python | 149 lines
                    
14# Copyright Buildbot Team Members
                    
15from twisted.trial import unittest
                    
16
                    
18from buildbot.process.results import EXCEPTION
                    
19from buildbot.process.results import FAILURE
                    
20from buildbot.process.results import SUCCESS
                    
21from buildbot.process.results import WARNINGS
                    
22from buildbot.steps import shellsequence
                    
23from buildbot.test.fake.remotecommand import Expect
                    
23from buildbot.test.fake.remotecommand import Expect
                    
24from buildbot.test.fake.remotecommand import ExpectShell
                    
25from buildbot.test.util import config as configmixin
                    
34
                    
35class TestOneShellCommand(steps.BuildStepMixin, unittest.TestCase, configmixin.ConfigErrorsMixin):
                    
36
                    
                
test_control.py https://gitlab.com/noc0lour/mailman | Python | 192 lines
                    
24import shutil
                    
25import signal
                    
26import socket
                    
26import socket
                    
27import unittest
                    
28
                    
32from mailman.config import Configuration, config
                    
33from mailman.testing.helpers import configuration
                    
34from mailman.testing.layers import ConfigLayer
                    
82
                    
83class TestStart(unittest.TestCase):
                    
84    """Test various starting scenarios."""
                    
144
                    
145class TestBinDir(unittest.TestCase):
                    
146    """Test issues related to bin_dir, e.g. issue #3"""
                    
                
bencode_tests.py https://gitlab.com/lukaf/python-bittorrent | Python | 464 lines
                    
6
                    
7class Walk(unittest.TestCase):
                    
8	""" Check the function walk() works correctly. """
                    
99
                    
100class Ben_Type(unittest.TestCase):
                    
101	""" Check the function ben_type() works correctly. """
                    
375
                    
376class Decode_Dict(unittest.TestCase):
                    
377	""" Check the function decode_dict() works correctly. """
                    
407
                    
408class Encode(unittest.TestCase):
                    
409	""" Check the encode() function works. As this dispatches to the other
                    
436
                    
437class Decode(unittest.TestCase):
                    
438	""" Check the decode() function works. As this dispatches to the other
                    
                
test_commands.py https://gitlab.com/e0/scrapy | Python | 293 lines
                    
1import os
                    
2import sys
                    
2import sys
                    
3import subprocess
                    
4import tempfile
                    
4import tempfile
                    
5from time import sleep
                    
6from os.path import exists, join, abspath
                    
6from os.path import exists, join, abspath
                    
7from shutil import rmtree, copytree
                    
8from tempfile import mkdtemp
                    
10
                    
11from twisted.trial import unittest
                    
12from twisted.internet import defer
                    
21
                    
22class ProjectTest(unittest.TestCase):
                    
23    project_name = 'testproject'
                    
                
zeyatest.py https://github.com/psung/zeya.git | Python | 238 lines
                    
25import os
                    
26import unittest
                    
27
                    
58
                    
59class CommonTest(unittest.TestCase):
                    
60    def test_tokenization(self):
                    
145
                    
146class OptionsTest(unittest.TestCase):
                    
147    def test_default(self):
                    
185
                    
186class PlsTest(unittest.TestCase):
                    
187    def test_parse_pls(self):
                    
213
                    
214class RhythmboxTest(unittest.TestCase):
                    
215    def test_read_library(self):
                    
                
test_pep3118.py https://gitlab.com/pmuontains/Odoo | Python | 203 lines
                    
1import unittest
                    
2from ctypes import *
                    
19
                    
20class Test(unittest.TestCase):
                    
21
                    
26            try:
                    
27                self.assertEqual(normalize(v.format), normalize(fmt))
                    
28                if shape is not None:
                    
28                if shape is not None:
                    
29                    self.assertEqual(len(v), shape[0])
                    
30                else:
                    
36                # they are always read/write
                    
37                self.assertFalse(v.readonly)
                    
38
                    
42                        n = n * dim
                    
43                    self.assertEqual(n * v.itemsize, len(v.tobytes()))
                    
44            except:
                    
                
test_threadsignals.py https://gitlab.com/unofficial-mirrors/cpython | Python | 227 lines
                    
2
                    
3import unittest
                    
4import signal
                    
6import sys
                    
7from test.support import run_unittest, import_module
                    
8thread = import_module('_thread')
                    
38
                    
39class ThreadSignals(unittest.TestCase):
                    
40
                    
64        self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped'], 1)
                    
65        self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped_by'],
                    
66                           thread.get_ident())
                    
77    # Issue #20564: sem_timedwait() cannot be interrupted on OpenBSD
                    
78    @unittest.skipIf(sys.platform.startswith('openbsd'),
                    
79                     'lock cannot be interrupted on OpenBSD')
                    
                
test_cluster.py https://gitlab.com/africanresearchcloud/hpc | Python | 391 lines
                    
18
                    
19from __future__ import absolute_import
                    
20
                    
26import tempfile
                    
27import unittest
                    
28
                    
39
                    
40class TestCluster(unittest.TestCase):
                    
41
                    
104        self.assertEqual(size + 1, len(cluster.nodes['compute']))
                    
105        self.assertEqual(cluster.nodes['compute'][3].name, name)
                    
106
                    
249
                    
250class TestNode(unittest.TestCase):
                    
251
                    
                
test_profile.py https://gitlab.com/unofficial-mirrors/cpython | Python | 187 lines
                    
4import pstats
                    
5import unittest
                    
6import os
                    
6import os
                    
7from difflib import unified_diff
                    
8from io import StringIO
                    
8from io import StringIO
                    
9from test.support import TESTFN, run_unittest, unlink
                    
10from contextlib import contextmanager
                    
11
                    
12import profile
                    
13from test.profilee import testfunc, timer
                    
15
                    
16class ProfileTest(unittest.TestCase):
                    
17
                    
                
extract_sqlite_api_unittest.py https://github.com/chromium/chromium.git | Python | 295 lines
                    
10
                    
11from importlib.machinery import SourceFileLoader
                    
12import os
                    
15import tempfile
                    
16import unittest
                    
17
                    
18
                    
19class ExtractSqliteApiUnittest(unittest.TestCase):
                    
20    def setUp(self):
                    
102                         self.extractor.RemoveLineComments('wo/*comment*/rd;'))
                    
103        self.assertEqual(
                    
104            'word;*/', self.extractor.RemoveLineComments('wo/*comment*/rd;*/'))
                    
290        with open(output_file, 'r') as f:
                    
291            self.assertEqual(f.read(), golden_output)
                    
292
                    
                
tests.py https://github.com/apparentlymart/django.git | Python | 304 lines
                    
1import os, unittest
                    
2from django.contrib.gis.geos import *
                    
2from django.contrib.gis.geos import *
                    
3from django.contrib.gis.db.backend import SpatialBackend
                    
4from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
                    
5from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_spatialite
                    
6from django.conf import settings
                    
7from models import City, Location, DirectoryEntry, Parcel, Book, Author
                    
13
                    
14class RelatedGeoModelTest(unittest.TestCase):
                    
15
                    
31                nm, st, lon, lat = ref
                    
32                self.assertEqual(nm, c.name)
                    
33                self.assertEqual(st, c.state)
                    
159        qs = Parcel.objects.filter(center1=F('city__location__point'))
                    
160        self.assertEqual(1, len(qs))
                    
161        self.assertEqual('P1', qs[0].name)
                    
                
test_ds.py https://gitlab.com/gregtyka/Scryve-Webapp | Python | 233 lines
                    
1import os, os.path, unittest
                    
2from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError
                    
2from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError
                    
3from django.contrib.gis.gdal.field import OFTReal, OFTInteger, OFTString
                    
4from django.contrib import gis
                    
40
                    
41class DataSourceTest(unittest.TestCase):
                    
42
                    
50            # Making sure the layer count is what's expected (only 1 layer in a SHP file)
                    
51            self.assertEqual(1, len(ds))
                    
52
                    
115                        for fld_name in fld_names:
                    
116                            self.assertEqual(source.field_values[fld_name][i], feat.get(fld_name))
                    
117        print "\nEND - expecting out of range feature id error; safe to ignore."
                    
131            control_vals = source.field_values[fld_name][sl]
                    
132            self.assertEqual(control_vals, test_vals)
                    
133
                    
                
hid_gadget_test.py https://gitlab.com/jonnialva90/iridium-browser | Python | 258 lines
                    
5
                    
6import unittest
                    
7
                    
47
                    
48class HidGadgetTest(unittest.TestCase):
                    
49
                    
53                           vendor_id=0, product_id=0)
                    
54    with self.assertRaisesRegexp(ValueError, 'High speed'):
                    
55      hid_gadget.HidGadget(report_desc, features={}, interval_ms=5000,
                    
136
                    
137class HidFeatureTest(unittest.TestCase):
                    
138
                    
257if __name__ == '__main__':
                    
258  unittest.main()
                    
259
                    
                
test_BLAKE2.py https://gitlab.com/abhi1tb/build | Python | 443 lines
                    
31import re
                    
32import unittest
                    
33from binascii import unhexlify, hexlify
                    
42
                    
43class Blake2Test(unittest.TestCase):
                    
44
                    
327
                    
328class Blake2TestVector1(unittest.TestCase):
                    
329
                    
372
                    
373class Blake2TestVector2(unittest.TestCase):
                    
374
                    
440if __name__ == '__main__':
                    
441    import unittest
                    
442    suite = lambda: unittest.TestSuite(get_tests())
                    
                
test_schedulers_triggerable.py https://gitlab.com/murder187ss/buildbot | Python | 333 lines
                    
21from twisted.python import log
                    
22from twisted.trial import unittest
                    
23
                    
27from buildbot.test.util import interfaces
                    
28from buildbot.test.util import scheduler
                    
29from buildbot.test.util.decorators import flaky
                    
31
                    
32class TriggerableInterfaceTest(unittest.TestCase, interfaces.InterfaceTests):
                    
33
                    
37
                    
38class Triggerable(scheduler.SchedulerMixin, unittest.TestCase):
                    
39
                    
156        sched = self.makeScheduler()
                    
157        self.assertEqual(sched.reason, "The Triggerable scheduler named 'n' triggered this build")
                    
158
                    
                
httpclient_test.py https://gitlab.com/jonnialva90/iridium-browser | Python | 185 lines
                    
15
                    
16import unittest
                    
17
                    
21
                    
22class RealHttpFetchTest(unittest.TestCase):
                    
23
                    
58    name_value = real_http_fetch._GetHeaderNameValue(self.BAD_HEADER)
                    
59    self.assertIsNone(name_value)
                    
60
                    
118
                    
119class RealHttpFetchGetConnectionTest(unittest.TestCase):
                    
120  """Test that a connection is made with request IP/port or proxy IP/port."""
                    
145    self.assertEqual('127.127.127.127', connection.host)
                    
146    self.assertEqual(80, connection.port)  # default HTTP port
                    
147
                    
                
test_it.py https://gitlab.com/github-cloud-corporation/pattern | Python | 272 lines
                    
2import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
                    
3import unittest
                    
4import subprocess
                    
14
                    
15class TestInflection(unittest.TestCase):
                    
16
                    
41        v = it.referenced("amica", gender="f")
                    
42        self.assertEqual(v, "un'amica")
                    
43        print("pattern.it.article()")
                    
104            n += 1
                    
105        self.assertTrue(float(i) / n > 0.81)
                    
106        print("pattern.it.inflect.verbs.find_lemma()")
                    
197
                    
198class TestParser(unittest.TestCase):
                    
199    
                    
                
api.py https://bitbucket.org/bluezoo/trac.git | Python | 364 lines
                    
15import io
                    
16import unittest
                    
17
                    
30
                    
31class GetMimeTypeTestCase(unittest.TestCase):
                    
32
                    
74
                    
75class MimeviewTestCase(unittest.TestCase):
                    
76
                    
106
                    
107class GroupLinesTestCase(unittest.TestCase):
                    
108
                    
239
                    
240class MimeviewConverterTestCase(unittest.TestCase):
                    
241
                    
                
test_functions.py https://bitbucket.org/hacman/python.git | Python | 408 lines
                    
8from ctypes import *
                    
9import sys, unittest
                    
10
                    
16
                    
17import _ctypes_test
                    
18dll = CDLL(_ctypes_test.__file__)
                    
26                ("right", c_int), ("bottom", c_int)]
                    
27class FunctionTestCase(unittest.TestCase):
                    
28
                    
44
                    
45        from _ctypes import _Pointer
                    
46        try:
                    
51
                    
52        from _ctypes import _SimpleCData
                    
53        try:
                    
                
log_testing.py https://github.com/chromium/chromium.git | Python | 233 lines
                    
32import logging
                    
33import unittest
                    
34
                    
51        Args:
                    
52            test_case: A unittest.TestCase instance.
                    
53        """
                    
77
                    
78      class SampleTest(unittest.TestCase):
                    
79
                    
126        This method should normally be called in the setUp() method
                    
127        of a unittest.TestCase.  See the docstring of this class
                    
128        for more details.
                    
130        Args:
                    
131            test_case: A unittest.TestCase instance.
                    
132            logging_level: An integer logging level that is the minimum level
                    
                
test_www_hooks_bitbucket.py https://gitlab.com/murder187ss/buildbot | Python | 267 lines
                    
18from twisted.internet.defer import inlineCallbacks
                    
19from twisted.trial import unittest
                    
20
                    
22
                    
23from buildbot.test.fake.web import FakeRequest
                    
24from buildbot.test.fake.web import fakeMasterForHooks
                    
137
                    
138class TestChangeHookConfiguredWithBitbucketChange(unittest.TestCase):
                    
139
                    
189
                    
190        self.assertEqual(len(self.change_hook.master.addedChanges), 0)
                    
191        self.assertEqual(request.written, 'no changes found')
                    
249            500, 'Error processing changes.')
                    
250        self.assertEqual(len(self.flushLoggedErrors()), 1)
                    
251
                    
                
test_data_changesources.py https://gitlab.com/murder187ss/buildbot | Python | 232 lines
                    
18from twisted.python import failure
                    
19from twisted.trial import unittest
                    
20
                    
28
                    
29class ChangeSourceEndpoint(endpoint.EndpointMixin, unittest.TestCase):
                    
30
                    
67            self.validateData(changesource)
                    
68            self.assertEqual(changesource['master'], None),
                    
69        return d
                    
108
                    
109class ChangeSourcesEndpoint(endpoint.EndpointMixin, unittest.TestCase):
                    
110
                    
160
                    
161class ChangeSource(interfaces.InterfaceTests, unittest.TestCase):
                    
162
                    
                
test_random.py https://gitlab.com/abhi1tb/build | Python | 167 lines
                    
27import sys
                    
28import unittest
                    
29from Crypto.Util.py3compat import b
                    
30
                    
31class SimpleTest(unittest.TestCase):
                    
32    def runTest(self):
                    
33        """Crypto.Random.new()"""
                    
34        # Import the Random module and try to use it
                    
35        from Crypto import Random
                    
38        y = randobj.read(16)
                    
39        self.assertNotEqual(x, y)
                    
40        z = Random.get_random_bytes(16)
                    
40        z = Random.get_random_bytes(16)
                    
41        self.assertNotEqual(x, z)
                    
42        self.assertNotEqual(y, z)
                    
                
test_lmtp.py https://gitlab.com/noc0lour/mailman | Python | 206 lines
                    
21import smtplib
                    
22import unittest
                    
23
                    
31
                    
32class TestLMTP(unittest.TestCase):
                    
33    """Test various aspects of the LMTP server."""
                    
56        self.assertEqual(cm.exception.smtp_code, 550)
                    
57        self.assertEqual(cm.exception.smtp_error,
                    
58                         b'No Message-ID header provided')
                    
82        all_headers = items[0].msg.get_all('message-id-hash')
                    
83        self.assertEqual(len(all_headers), 1)
                    
84        self.assertEqual(items[0].msg['message-id-hash'],
                    
168
                    
169class TestBugs(unittest.TestCase):
                    
170    """Test some LMTP related bugs."""
                    
                
json3_output_unittest.py https://github.com/chromium/chromium.git | Python | 205 lines
                    
5import copy
                    
6import unittest
                    
7
                    
7
                    
8from core.results_processor.formatters import json3_output
                    
9from core.results_processor import testing
                    
11
                    
12class Json3OutputTest(unittest.TestCase):
                    
13  def setUp(self):
                    
21    # Convert should not modify the original intermediate results.
                    
22    self.assertEqual(test_results_copy, test_results)
                    
23    return results
                    
27    for key in (benchmark, story):
                    
28      self.assertIn(key, node)
                    
29      node = node[key]
                    
                
gpu_test_expectations_unittest.py https://gitlab.com/jonnialva90/iridium-browser | Python | 183 lines
                    
3# found in the LICENSE file.
                    
4import unittest
                    
5
                    
6from telemetry.internal.platform import system_info
                    
7from telemetry.page import page as page_module
                    
8from telemetry.story import story_set
                    
9
                    
10import gpu_test_expectations
                    
11
                    
71
                    
72class GpuTestExpectationsTest(unittest.TestCase):
                    
73  def setUp(self):
                    
123        StubPlatform('mac'), VENDOR_AMD, 0x1001)
                    
124    self.assertExpectationEquals('pass', page,
                    
125        StubPlatform('win'), VENDOR_AMD, 0x1002)
                    
                
test_with_pandas.py https://gitlab.com/github-cloud-corporation/xgboost | Python | 176 lines
                    
1# -*- coding: utf-8 -*-
                    
2import numpy as np
                    
3import xgboost as xgb
                    
4import testing as tm
                    
5import unittest
                    
6
                    
7try:
                    
8    import pandas as pd
                    
9except ImportError:
                    
19
                    
20class TestPandas(unittest.TestCase):
                    
21
                    
40        df = pd.DataFrame([[1, 2., 'x'], [2, 3., 'y']], columns=['a', 'b', 'c'])
                    
41        self.assertRaises(ValueError, xgb.DMatrix, df)
                    
42
                    
                
unittest_pyreverse_diadefs.py https://gitlab.com/holtscomm/gae-purchase-order-system | Python | 174 lines
                    
19
                    
20import unittest
                    
21import sys
                    
53
                    
54class DiaDefGeneratorTC(unittest.TestCase):
                    
55    def test_option_values(self):
                    
89
                    
90class DefaultDiadefGeneratorTC(unittest.TestCase):
                    
91    def test_known_values1(self):
                    
92        dd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)
                    
93        self.assertEqual(len(dd), 2)
                    
94        keys = [d.TYPE for d in dd]
                    
148
                    
149class ClassDiadefGeneratorTC(unittest.TestCase):
                    
150    def test_known_values1(self):
                    
                
test_key.py https://bitbucket.org/davidgorski/boto.git | Python | 375 lines
                    
26
                    
27from tests.unit import unittest
                    
28import time
                    
28import time
                    
29import StringIO
                    
30from boto.s3.connection import S3Connection
                    
30from boto.s3.connection import S3Connection
                    
31from boto.s3.key import Key
                    
32from boto.exception import S3ResponseError
                    
34
                    
35class S3KeyTest (unittest.TestCase):
                    
36    s3 = True
                    
61        k.set_contents_from_file(sfp, rewind=True)
                    
62        self.assertEqual(k.size, 5)
                    
63        # check actual contents by getting it.
                    
                
testHod.py https://gitlab.com/essere.lab.public/qualitas.class-corpus | Python | 310 lines
                    
15#limitations under the License.
                    
16import unittest, getpass, os, sys, re, threading, time
                    
17
                    
24from testing.lib import BaseTestSuite, MockLogger, MockHadoopCluster
                    
25from hodlib.Hod.hod import hodRunner, hodState
                    
26from hodlib.Common.desc import NodePoolDesc
                    
64# Test class that defines methods to test invalid arguments to hod operations.
                    
65class test_InvalidArgsOperations(unittest.TestCase):
                    
66  def setUp(self):
                    
155    os.makedirs(clusterDir)
                    
156    self.assertTrue(os.path.isdir(clusterDir))
                    
157    jobid = '789.dummy.id1'
                    
206
                    
207class test_InvalidHodStateFiles(unittest.TestCase):
                    
208  def setUp(self):
                    
                
test_bot.py https://gitlab.com/murder187ss/buildbot | Python | 429 lines
                    
15
                    
16from builtins import range
                    
17
                    
27from twisted.python import log
                    
28from twisted.trial import unittest
                    
29
                    
39
                    
40class TestBot(unittest.TestCase):
                    
41
                    
216
                    
217class TestWorkerForBuilder(command.CommandTestMixin, unittest.TestCase):
                    
218
                    
386
                    
387class TestBotFactory(unittest.TestCase):
                    
388
                    
                
flakytestreporter_unittest.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 167 lines
                    
28
                    
29import unittest
                    
30
                    
30
                    
31from webkitpy.common.config.committers import Committer
                    
32from webkitpy.common.system.filesystem_mock import MockFileSystem
                    
33from webkitpy.common.system.outputcapture import OutputCapture
                    
34from webkitpy.layout_tests.layout_package import test_results
                    
35from webkitpy.layout_tests.layout_package import test_failures
                    
37from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter
                    
38from webkitpy.tool.mocktool import MockTool, MockStatusServer
                    
39
                    
53
                    
54class FlakyTestReporterTest(unittest.TestCase):
                    
55    def _mock_test_result(self, testname):
                    
                
test_difflib.py https://gitlab.com/pmuontains/Odoo | Python | 281 lines
                    
1import difflib
                    
2from test.test_support import run_unittest, findfile
                    
3import unittest
                    
7
                    
8class TestWithAscii(unittest.TestCase):
                    
9    def test_one_insert(self):
                    
30
                    
31class TestAutojunk(unittest.TestCase):
                    
32    """Tests for the autojunk parameter added in 2.7"""
                    
142
                    
143class TestSFpatches(unittest.TestCase):
                    
144
                    
209
                    
210class TestOutputFormat(unittest.TestCase):
                    
211    def test_tab_delimiter(self):
                    
                
test_spider.py https://gitlab.com/e0/scrapy | Python | 400 lines
                    
1import gzip
                    
2import inspect
                    
2import inspect
                    
3import warnings
                    
4from io import BytesIO
                    
6from testfixtures import LogCapture
                    
7from twisted.trial import unittest
                    
8
                    
8
                    
9from scrapy import signals
                    
10from scrapy.settings import Settings
                    
22
                    
23class SpiderTest(unittest.TestCase):
                    
24
                    
343
                    
344class BaseSpiderDeprecationTest(unittest.TestCase):
                    
345
                    
                
test_extensions.py https://gitlab.com/unofficial-mirrors/cpython | Python | 298 lines
                    
1import sys
                    
2import unittest
                    
3import tkinter
                    
4from tkinter import ttk
                    
5from test.support import requires, run_unittest, swap_attr
                    
6from tkinter.test.support import AbstractTkTest, destroy_default_root
                    
9
                    
10class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
                    
11
                    
137        lscale.scale.configure(from_=0, to=10)
                    
138        self.assertNotEqual(prev_xcoord, curr_xcoord)
                    
139        self.assertEqual(prev_xcoord, int(linfo_1['x']))
                    
206
                    
207class OptionMenuTest(AbstractTkTest, unittest.TestCase):
                    
208
                    
                
db_mysql.py https://gitlab.com/pmuontains/Odoo | Python | 165 lines
                    
3# Based on tests by: aarranz
                    
4from south.tests import unittest
                    
5
                    
10
                    
11class TestMySQLOperations(unittest.TestCase):
                    
12    """MySQL-specific tests"""
                    
47            reference_table))))
                    
48        self.assertEquals(constraint_name, constraint)
                    
49        references = db._lookup_constraint_references(main_table, constraint)
                    
92        constraints = db._find_foreign_constraints(main_table, 'foreign_id')
                    
93        self.assertEquals(len(constraints), 1)
                    
94        db.rename_column(main_table, 'foreign_id', 'reference_id')
                    
96        constraints = db._find_foreign_constraints(main_table, 'reference_id')
                    
97        self.assertEquals(len(constraints), 1)
                    
98        db.delete_table(main_table)
                    
                
test_pointers.py https://gitlab.com/abhi1tb/build | Python | 223 lines
                    
1import unittest, sys
                    
2
                    
10
                    
11class PointersTestCase(unittest.TestCase):
                    
12
                    
19        # Pointer can't set contents: has no _type_
                    
20        self.assertRaises(TypeError, A, c_ulong(33))
                    
21
                    
32        address = func(byref(i))
                    
33        self.assertEqual(c_int.from_address(address).value, 12345678)
                    
34
                    
138        # Although a pointer can be indexed, it has no length
                    
139        self.assertRaises(TypeError, len, p)
                    
140        self.assertEqual(p[0], 42)
                    
203        # to not leak references, we must clean _pointer_type_cache
                    
204        from ctypes import _pointer_type_cache
                    
205        del _pointer_type_cache[LargeNamedType]
                    
                
test_imaplib.py https://gitlab.com/envieidoc/Clover | Python | 240 lines
                    
10import SocketServer
                    
11import time
                    
12
                    
13from test_support import reap_threads, verbose, transient_internet
                    
14import unittest
                    
15
                    
23
                    
24class TestImaplib(unittest.TestCase):
                    
25
                    
102
                    
103class BaseThreadedNetworkedTests(unittest.TestCase):
                    
104
                    
180
                    
181class RemoteIMAPTest(unittest.TestCase):
                    
182    host = 'cyrus.andrew.cmu.edu'
                    
                
test_solvers.py https://gitlab.com/christoph-conrads/DCGeig | Python | 486 lines
                    
9
                    
10import unittest
                    
11
                    
247
                    
248class Test_solve_with_qr_csd(unittest.TestCase):
                    
249    dtypes = [NP.float32, NP.float64]
                    
296
                    
297class Test_solve_with_gsvd(unittest.TestCase):
                    
298    dtypes = [NP.float32, NP.float64]
                    
342
                    
343class Test_deflate_gep(unittest.TestCase):
                    
344    dtypes = [NP.float32, NP.float64]
                    
440
                    
441class Test_solve_with_deflation(unittest.TestCase):
                    
442    dtypes = [NP.float32, NP.float64]
                    
                
test_nailgun_protocol.py https://gitlab.com/Ivy001/pants | Python | 217 lines
                    
4
                    
5from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                    
6                        unicode_literals, with_statement)
                    
8import socket
                    
9import unittest
                    
10
                    
15
                    
16class TestChunkType(unittest.TestCase):
                    
17  def test_chunktype_constants(self):
                    
29
                    
30class TestNailgunProtocol(unittest.TestCase):
                    
31  EMPTY_PAYLOAD = ''
                    
61    self.assertEqual(arguments, self.TEST_ARGUMENTS)
                    
62    self.assertEqual(environment, self.TEST_ENVIRON)
                    
63
                    
                
test_dirutil.py https://gitlab.com/Ivy001/pants | Python | 335 lines
                    
4
                    
5from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                    
6                        unicode_literals, with_statement)
                    
7
                    
8import errno
                    
9import os
                    
10import time
                    
11import unittest
                    
12
                    
27
                    
28class DirutilTest(unittest.TestCase):
                    
29
                    
282
                    
283class AbsoluteSymlinkTest(unittest.TestCase):
                    
284  def setUp(self):
                    
                
tests.py https://gitlab.com/asmjahid/django | Python | 325 lines
                    
1from __future__ import unicode_literals
                    
2
                    
2
                    
3import unittest
                    
4from datetime import datetime
                    
5
                    
6from django.core.paginator import (
                    
7    EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
                    
8)
                    
9from django.test import TestCase
                    
10from django.utils import six
                    
11
                    
12from .custom import ValidAdjacentNumsPaginator
                    
13from .models import Article
                    
15
                    
16class PaginationTests(unittest.TestCase):
                    
17    """
                    
                
test_repr.py https://github.com/pieper/python.git | Python | 327 lines
                    
8import shutil
                    
9import unittest
                    
10
                    
10
                    
11from test.test_support import run_unittest
                    
12from repr import repr as r # Don't shadow builtin repr
                    
21
                    
22class ReprTests(unittest.TestCase):
                    
23
                    
132        self.failUnless(repr(fp).startswith(
                    
133            "<open file '%s', mode 'r' at 0x" % unittest.__file__))
                    
134        fp.close()
                    
213
                    
214class LongReprTest(unittest.TestCase):
                    
215    def setUp(self):
                    
                
test_db_migrate_versions_045_worker_transition.py https://gitlab.com/murder187ss/buildbot | Python | 384 lines
                    
19from twisted.internet import defer
                    
20from twisted.trial import unittest
                    
21
                    
21
                    
22from buildbot.db.types.json import JsonObject
                    
23from buildbot.test.util import migration
                    
26
                    
27class Migration(migration.MigrateTestMixin, unittest.TestCase):
                    
28
                    
193            ).order_by(c.id)
                    
194            self.assertEqual(
                    
195                q.execute().fetchall(), [
                    
209            # have no reference to it.
                    
210            self.assertEqual(
                    
211                q.execute().fetchall(), [
                    
                
test_init.py https://gitlab.com/mkerfoot/home-assistant | Python | 245 lines
                    
8import unittest
                    
9from unittest.mock import patch
                    
10from datetime import datetime, timedelta
                    
10from datetime import datetime, timedelta
                    
11import os
                    
12
                    
13from homeassistant.config import load_yaml_config_file
                    
14from homeassistant.loader import get_component
                    
15import homeassistant.util.dt as dt_util
                    
24
                    
25class TestComponentsDeviceTracker(unittest.TestCase):
                    
26    """ Tests homeassistant.components.device_tracker module. """
                    
112        self.assertEqual(device.dev_id, config.dev_id)
                    
113        self.assertEqual(device.track, config.track)
                    
114        self.assertEqual(device.mac, config.mac)
                    
                
test_unicode_file_functions.py https://gitlab.com/unofficial-mirrors/cpython | Python | 195 lines
                    
2# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
                    
3import os
                    
4import sys
                    
4import sys
                    
5import unittest
                    
6import warnings
                    
6import warnings
                    
7from unicodedata import normalize
                    
8from test import support
                    
54    except UnicodeEncodeError:
                    
55        raise unittest.SkipTest("only NT+ and systems with "
                    
56                                "Unicode-friendly filesystem encoding")
                    
58
                    
59class UnicodeFileTests(unittest.TestCase):
                    
60    files = set(filenames)
                    
                
test_redaction.py https://gitlab.com/JigmeDatse/synapse | Python | 211 lines
                    
16
                    
17from tests import unittest
                    
18from twisted.internet import defer
                    
22
                    
23from tests.utils import setup_test_homeserver
                    
24
                    
27
                    
28class RedactionTestCase(unittest.TestCase):
                    
29
                    
126
                    
127        self.assertFalse("redacted_because" in event.unsigned)
                    
128
                    
136
                    
137        self.assertEqual(msg_event.event_id, event.event_id)
                    
138
                    
                
test_sqlalchemy.py https://gitlab.com/gregtyka/frankenserver | Python | 415 lines
                    
9
                    
10import unittest
                    
11
                    
17
                    
18    from pyamf.adapters import _sqlalchemy_orm as adapter
                    
19except ImportError:
                    
49
                    
50class BaseTestCase(unittest.TestCase):
                    
51    """
                    
255
                    
256        self.assertEqual(sorted(attrs.keys()), [
                    
257            'addresses',
                    
387        self.assertNotEquals(None, adapter.class_mapper(User))
                    
388        self.assertTrue(adapter.is_class_sa_mapped(User))
                    
389
                    
                
committer_auth_unittest.py https://gitlab.com/x33n/phantomjs | Python | 220 lines
                    
29import os
                    
30import unittest
                    
31
                    
52
                    
53class CommitterAuthTest(unittest.TestCase):
                    
54    def setUp(self):
                    
103        auth.open_auth_json_file = self.invalid_auth_json_file
                    
104        self.assertFalse(auth.authenticate('committer@webkit.org', 'committerpassword'))
                    
105        self.assertEqual('Error parsing auth.json file: No JSON object could be decoded', auth.errmsg())
                    
108        self.auth.open_webkit_committers_file = self.invalid_committers_file
                    
109        self.assertFalse(self.auth.authenticate('committer@webkit.org', 'committerpassword'))
                    
110        self.assertEqual('Error parsing WebKit committers file', self.auth.errmsg())
                    
173        self.assertFalse(self.auth.authenticate('committer@webkit.org', 'wrongpassword'))
                    
174        self.assertEqual('Invalid username/password', self.auth.errmsg())
                    
175
                    
                
test_u2ftoken.py https://gitlab.com/sheshanarayanag/LinOTP | Python | 343 lines
                    
31    try:
                    
32        import unittest2 as unittest
                    
33    except ImportError as exc:
                    
33    except ImportError as exc:
                    
34        print "You need to install unittest2 on Python 2.6. Unittest2 is a "\
                    
35              "backport of new unittest features."
                    
37else:
                    
38    import unittest
                    
39
                    
42
                    
43class U2FTokenClassTestCase(unittest.TestCase):
                    
44
                    
143        self.u2f_token.token.LinOtpIsactive = True
                    
144        with self.assertRaises(ValueError):
                    
145            self.u2f_token._verifyCounterValue(499)
                    
                
test_es.py https://gitlab.com/admin-github-cloud/pattern | Python | 256 lines
                    
2import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
                    
3import unittest
                    
4import subprocess
                    
14
                    
15class TestInflection(unittest.TestCase):
                    
16
                    
21        # Assert the accuracy of the pluralization algorithm.
                    
22        from pattern.db import Datasheet
                    
23        test = {}
                    
169        # Assert tense recognition.
                    
170        self.assertTrue((es.PRESENT, 3, es.SG) in es.tenses("es"))
                    
171        self.assertTrue("2sg" in es.tenses("eres"))
                    
184
                    
185class TestParser(unittest.TestCase):
                    
186    
                    
                
fetch.py https://gitlab.com/vipemb/yocto-study | Python | 191 lines
                    
19
                    
20import unittest
                    
21import tempfile
                    
26
                    
27class FetcherTest(unittest.TestCase):
                    
28
                    
91        fetcher.unpack(self.unpackdir)
                    
92        self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9)
                    
93        self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.1/")), 9)
                    
98        fetcher.download()
                    
99        self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
                    
100
                    
171
                    
172class URLHandle(unittest.TestCase):
                    
173
                    
                
test_queue.py https://gitlab.com/minoca/tools | Python | 325 lines
                    
4import time
                    
5import unittest
                    
6from test import test_support
                    
196
                    
197class QueueTest(BaseQueueTest, unittest.TestCase):
                    
198    type2test = Queue.Queue
                    
199
                    
200class LifoQueueTest(BaseQueueTest, unittest.TestCase):
                    
201    type2test = Queue.LifoQueue
                    
202
                    
203class PriorityQueueTest(BaseQueueTest, unittest.TestCase):
                    
204    type2test = Queue.PriorityQueue
                    
227
                    
228class FailingQueueTest(BlockingTestMixin, unittest.TestCase):
                    
229
                    
                
test_moderation.py https://gitlab.com/mmhat/mailman | Python | 330 lines
                    
19
                    
20import unittest
                    
21
                    
24from mailman.interfaces.bans import IBanManager
                    
25from mailman.interfaces.member import MemberRole
                    
26from mailman.interfaces.usermanager import IUserManager
                    
33
                    
34class TestModeration(unittest.TestCase):
                    
35    """Test the approved handler."""
                    
106        reasons = msgdata['moderation_reasons']
                    
107        self.assertEqual(
                    
108            reasons, ['The message comes from a moderated member'])
                    
282        result = rule.check(self._mlist, msg, {})
                    
283        self.assertFalse(result)
                    
284        rule = moderation.NonmemberModeration()
                    
                
test_ident.py https://gitlab.com/xivo.solutions/xivo-provisioning | Python | 362 lines
                    
20from twisted.internet import defer
                    
21from twisted.trial import unittest
                    
22
                    
52
                    
53class TestLastSeenUpdater(unittest.TestCase):
                    
54
                    
120
                    
121class TestRemoveOutdatedIpDeviceUpdater(unittest.TestCase):
                    
122
                    
156
                    
157class TestRequestHelper(unittest.TestCase):
                    
158
                    
334
                    
335class TestLogSensitiveRequest(unittest.TestCase):
                    
336
                    
                
test_thread.py https://gitlab.com/pmuontains/Odoo | Python | 261 lines
                    
1import os
                    
2import unittest
                    
3import random
                    
24
                    
25class BasicThreadTest(unittest.TestCase):
                    
26
                    
67        # Various stack size tests.
                    
68        self.assertEqual(thread.stack_size(), 0, "initial stack size is not 0")
                    
69
                    
72
                    
73    @unittest.skipIf(os.name not in ("nt", "os2", "posix"), 'test meant for nt, os2, and posix')
                    
74    def test_nt_and_posix_stack_size(self):
                    
218
                    
219class TestForkInThread(unittest.TestCase):
                    
220    def setUp(self):
                    
                
test_turtle.py https://gitlab.com/unofficial-mirrors/cpython | Python | 436 lines
                    
1import pickle
                    
2import unittest
                    
3from test import support
                    
49
                    
50class TurtleConfigTest(unittest.TestCase):
                    
51
                    
130
                    
131class TestVec2D(VectorComparisonMixin, unittest.TestCase):
                    
132
                    
250
                    
251class TestTNavigator(VectorComparisonMixin, unittest.TestCase):
                    
252
                    
411
                    
412class TestTPen(unittest.TestCase):
                    
413
                    
                
diff.py https://bitbucket.org/bluezoo/trac.git | Python | 262 lines
                    
13
                    
14from trac.versioncontrol import diff
                    
15
                    
15
                    
16import unittest
                    
17
                    
22
                    
23class DiffTestCase(unittest.TestCase):
                    
24
                    
25    def testget_change_extent(self):
                    
26        self.assertEqual((3, 0), diff.get_change_extent('xxx', 'xxx'))
                    
27        self.assertEqual((0, 0), diff.get_change_extent('', 'xxx'))
                    
27        self.assertEqual((0, 0), diff.get_change_extent('', 'xxx'))
                    
28        self.assertEqual((0, 0), diff.get_change_extent('xxx', ''))
                    
29        self.assertEqual((0, 0), diff.get_change_extent('xxx', 'yyy'))
                    
                
test_compiler.py https://gitlab.com/CoastHeavyIndustries/OSM-stats | Python | 317 lines
                    
3from compiler.ast import flatten
                    
4import os, sys, time, unittest
                    
5from random import random
                    
16
                    
17class CompilerTest(unittest.TestCase):
                    
18
                    
74
                    
75        self.assertRaises(SyntaxError, compiler.parse, "foo(a=1, b)")
                    
76        self.assertRaises(SyntaxError, compiler.parse, "foo(1, *args, 3)")
                    
146        c = compiler.compile('{1, 2, 3}', '<string>', 'eval')
                    
147        self.assertEquals(eval(c), {1,2,3})
                    
148        c = compiler.compile('{1, 2, 3,}', '<string>', 'eval')
                    
152        c = compiler.compile('{1:2, 2:3, 3:4}', '<string>', 'eval')
                    
153        self.assertEquals(eval(c), {1:2, 2:3, 3:4})
                    
154        c = compiler.compile('{1:2, 2:3, 3:4,}', '<string>', 'eval')
                    
                
error_handlers_unittest.py https://gitlab.com/x33n/phantomjs | Python | 196 lines
                    
25
                    
26import unittest2 as unittest
                    
27
                    
28from checker import StyleProcessorConfiguration
                    
29from error_handlers import DefaultStyleErrorHandler
                    
30from filter import FilterConfiguration
                    
32
                    
33class DefaultStyleErrorHandlerTest(unittest.TestCase):
                    
34
                    
134        self.assertEqual(0, self._error_count)
                    
135        self.assertEqual([], self._error_messages)
                    
136
                    
147        self._call_error_handler(error_handler, confidence)
                    
148        self.assertEqual(1, self._error_count)
                    
149        self.assertEqual(1, len(self._error_messages))
                    
                
ra.py https://github.com/schwern/alien-svn.git | Python | 395 lines
                    
20#
                    
21import unittest, setup_path
                    
22
                    
22
                    
23from svn import core, repos, fs, delta, ra
                    
24from sys import version_info # For Python version check
                    
26  # Python >=3.0
                    
27  from io import StringIO
                    
28else:
                    
29  # Python <3.0
                    
30  from StringIO import StringIO
                    
31
                    
33
                    
34class SubversionRepositoryAccessTestCase(unittest.TestCase):
                    
35  """Test cases for the Subversion repository layer"""
                    
                
test_test_util_validation.py https://gitlab.com/murder187ss/buildbot | Python | 200 lines
                    
14# Copyright Buildbot Team Members
                    
15import datetime
                    
16
                    
17from twisted.python import log
                    
18from twisted.trial import unittest
                    
19
                    
19
                    
20from buildbot.test.util import validation
                    
21from buildbot.util import UTC
                    
23
                    
24class VerifyDict(unittest.TestCase):
                    
25
                    
29            msgs = list(validator.validate('g', g))
                    
30            self.assertEqual(msgs, [], 'messages for %r' % (g,))
                    
31        for b in bad:
                    
                
nlri_tests.py https://gitlab.com/rendoaw/exabgp | Python | 377 lines
                    
9
                    
10import unittest
                    
11
                    
11
                    
12from exabgp.reactor.protocol import AFI, SAFI
                    
13
                    
13
                    
14from exabgp.bgp.message.update import Attributes
                    
15
                    
15
                    
16from exabgp.bgp.message.update.attribute.localpref import LocalPreference
                    
17from exabgp.bgp.message.update.attribute.community.extended.communities \
                    
46
                    
47class TestNLRIs(unittest.TestCase):
                    
48
                    
                
test_scripts_create_master.py https://gitlab.com/murder187ss/buildbot | Python | 244 lines
                    
14# Copyright Buildbot Team Members
                    
15from future.utils import itervalues
                    
16
                    
21from twisted.internet import defer
                    
22from twisted.trial import unittest
                    
23
                    
40
                    
41class TestCreateMaster(misc.StdoutAssertionsMixin, unittest.TestCase):
                    
42
                    
92class TestCreateMasterFunctions(www.WwwTestMixin, dirs.DirsMixin,
                    
93                                misc.StdoutAssertionsMixin, unittest.TestCase):
                    
94
                    
162        create_master.makeTAC(mkconfig(basedir='test', **{'no-logrotate': True}))
                    
163        self.assertNotInTacFile("import Log")
                    
164        self.assertWasQuiet()
                    
                
logtesting.py https://gitlab.com/brian0218/rk3188_r-box_android4.2.2_sdk | Python | 258 lines
                    
51        Args:
                    
52          test_case: A unittest.TestCase instance.
                    
53
                    
83
                    
84          class SampleTest(unittest.TestCase):
                    
85
                    
141        Args:
                    
142          test_case: A unittest.TestCase instance.
                    
143          logging_level: An integer logging level that is the minimum level
                    
215# FIXME: Rename this class to LoggingTestCaseBase to be sure that
                    
216#        the unittest module does not interpret this class as a unittest
                    
217#        test case itself.
                    
217#        test case itself.
                    
218class LoggingTestCase(unittest.TestCase):
                    
219
                    
                
default_workflow.py https://bitbucket.org/bluezoo/trac.git | Python | 402 lines
                    
17import tempfile
                    
18import unittest
                    
19
                    
31
                    
32class ConfigurableTicketWorkflowTestCase(unittest.TestCase):
                    
33
                    
202
                    
203class ResetActionTestCase(unittest.TestCase):
                    
204
                    
256
                    
257class SetOwnerAttributeTestCase(unittest.TestCase):
                    
258
                    
326
                    
327class RestrictOwnerTestCase(unittest.TestCase):
                    
328
                    
                
test_formatparagraph.py https://gitlab.com/pmuontains/Odoo | Python | 377 lines
                    
1# Test the functions and main class method of FormatParagraph.py
                    
2import unittest
                    
3from idlelib import FormatParagraph as fp
                    
39
                    
40class FindTest(unittest.TestCase):
                    
41    """Test the find_paragraph function in FormatParagraph.
                    
158
                    
159class ReformatFunctionTest(unittest.TestCase):
                    
160    """Test the reformat_paragraph function without the editor window."""
                    
210
                    
211class FormatClassTest(unittest.TestCase):
                    
212    def test_init_close(self):
                    
242
                    
243class FormatEventTest(unittest.TestCase):
                    
244    """Test the formatting of text inside a Text widget.
                    
                
test_zone.py https://gitlab.com/jonnialva90/iridium-browser | Python | 196 lines
                    
25import time
                    
26from tests.compat import unittest
                    
27from nose.plugins.attrib import attr
                    
33@attr(route53=True)
                    
34class TestRoute53Zone(unittest.TestCase):
                    
35    @classmethod
                    
66        self.assertEquals(record.name, u'www.%s.' % self.base_domain)
                    
67        self.assertEquals(record.resource_records, [
                    
68            u'webserver.%s.' % self.base_domain
                    
76        record = self.zone.get_cname('www.%s' % self.base_domain)
                    
77        self.assertEquals(record.name, u'www.%s.' % self.base_domain)
                    
78        self.assertEquals(record.resource_records, [
                    
168@attr(route53=True)
                    
169class TestRoute53PrivateZone(unittest.TestCase):
                    
170    @classmethod
                    
                
test_run.py https://gitlab.com/abhi1tb/build | Python | 325 lines
                    
3from idlelib import run
                    
4import unittest
                    
5from unittest import mock
                    
11
                    
12class RunTest(unittest.TestCase):
                    
13
                    
70
                    
71class StdInputFilesTest(unittest.TestCase):
                    
72
                    
173
                    
174class StdOutputFilesTest(unittest.TestCase):
                    
175
                    
284
                    
285class TestSysRecursionLimitWrappers(unittest.TestCase):
                    
286
                    
                
leakdetector_unittest.py https://gitlab.com/x33n/phantomjs | Python | 152 lines
                    
28
                    
29import unittest2 as unittest
                    
30
                    
30
                    
31from webkitpy.port.leakdetector import LeakDetector
                    
32from webkitpy.common.system.filesystem_mock import MockFileSystem
                    
32from webkitpy.common.system.filesystem_mock import MockFileSystem
                    
33from webkitpy.common.system.outputcapture import OutputCapture
                    
34from webkitpy.common.system.executive_mock import MockExecutive
                    
36
                    
37class LeakDetectorTest(unittest.TestCase):
                    
38    def _mock_port(self):
                    
53        expected_args = ['--exclude-callstack=foo bar', '--exclude-callstack=BAZ', '--exclude-type=abcdefg', '--exclude-type=hi jklmno', 1234]
                    
54        self.assertEqual(detector._leaks_args(1234), expected_args)
                    
55
                    
                
test_scripts_runner.py https://gitlab.com/murder187ss/buildbot | Python | 411 lines
                    
81
                    
82class TestMakerBase(BaseDirTestsMixin, unittest.TestCase):
                    
83
                    
119
                    
120class TestRestartOptions(OptionsMixin, BaseDirTestsMixin, unittest.TestCase):
                    
121
                    
137
                    
138class TestCreateWorkerOptions(OptionsMixin, unittest.TestCase):
                    
139
                    
293
                    
294class TestOptions(misc.StdoutAssertionsMixin, unittest.TestCase):
                    
295
                    
327
                    
328class TestRun(misc.StdoutAssertionsMixin, unittest.TestCase):
                    
329
                    
                
test_archive_util.py https://gitlab.com/envieidoc/Clover | Python | 284 lines
                    
3
                    
4import unittest
                    
5import os
                    
5import os
                    
6import tarfile
                    
7from os.path import splitdrive
                    
7from os.path import splitdrive
                    
8import warnings
                    
9
                    
14from distutils.tests import support
                    
15from test.test_support import check_warnings, run_unittest
                    
16
                    
38                          support.LoggingSilencer,
                    
39                          unittest.TestCase):
                    
40
                    
                
test_MimeWriter.py https://gitlab.com/envieidoc/Clover | Python | 292 lines
                    
10import unittest, StringIO
                    
11from test.test_support import run_unittest, import_module
                    
12
                    
12
                    
13import_module("MimeWriter", deprecated=True)
                    
14from MimeWriter import MimeWriter
                    
194
                    
195class MimewriterTest(unittest.TestCase):
                    
196
                    
285
                    
286        self.assertEqual(buf.getvalue(), OUTPUT)
                    
287
                    
288def test_main():
                    
289    run_unittest(MimewriterTest)
                    
290
                    
                
multicommandtool_unittest.py https://gitlab.com/brian0218/rk3066_r-box_android4.2.2_sdk | Python | 177 lines
                    
29import sys
                    
30import unittest
                    
31
                    
66
                    
67class CommandTest(unittest.TestCase):
                    
68    def test_name_with_arguments(self):
                    
77        self.assertEqual(Command._parse_required_arguments("[ARG1] [ARG2]"), [])
                    
78        self.assertEqual(Command._parse_required_arguments("[ARG1] ARG2"), ["ARG2"])
                    
79        # Note: We might make our arg parsing smarter in the future and allow this type of arguments string.
                    
85        exit_code = OutputCapture().assert_outputs(self, two_required_arguments.check_arguments_and_execute, [None, ["foo"], TrivialTool()], expected_stderr=expected_missing_args_error)
                    
86        self.assertEqual(exit_code, 1)
                    
87
                    
99
                    
100class MultiCommandToolTest(unittest.TestCase):
                    
101    def _assert_split(self, args, expected_split):
                    
                
test_extensions.py https://gitlab.com/abhi1tb/build | Python | 323 lines
                    
1import sys
                    
2import unittest
                    
3import tkinter
                    
4from tkinter import ttk
                    
5from test.support import requires, run_unittest, swap_attr
                    
6from tkinter.test.support import AbstractTkTest, destroy_default_root
                    
9
                    
10class LabeledScaleTest(AbstractTkTest, unittest.TestCase):
                    
11
                    
20        x.destroy()
                    
21        self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var)
                    
22
                    
206
                    
207class OptionMenuTest(AbstractTkTest, unittest.TestCase):
                    
208
                    
                
test_bsddb.py https://gitlab.com/envieidoc/Clover | Python | 357 lines
                    
2"""Test script for the bsddb C module by Roger E. Masse
                    
3   Adapted to unittest format and expanded scope by Raymond Hettinger
                    
4"""
                    
5import os, sys
                    
6import unittest
                    
7from test import test_support
                    
9# Skip test if _bsddb wasn't built.
                    
10test_support.import_module('_bsddb')
                    
11
                    
11
                    
12bsddb = test_support.import_module('bsddb', deprecated=True)
                    
13# Just so we know it's imported:
                    
16
                    
17class TestBSDDB(unittest.TestCase):
                    
18    openflag = 'c'
                    
                
test_numbers.py https://github.com/jwal/python-tutorial.git | Python | 246 lines
                    
1from ctypes import *
                    
2import unittest
                    
3import sys, struct
                    
42
                    
43class NumberTestCase(unittest.TestCase):
                    
44
                    
66        for t in signed_types + unsigned_types + float_types:
                    
67            self.assertRaises(TypeError, t, "")
                    
68            self.assertRaises(TypeError, t, None)
                    
114        for t in signed_types + unsigned_types:
                    
115            self.assertRaises(TypeError, t, 3.14)
                    
116            self.assertRaises(TypeError, t, f)
                    
160    def test_float_from_address(self):
                    
161        from array import array
                    
162        for t in float_types:
                    
                
test_imageop.py https://gitlab.com/pmuontains/Odoo | Python | 211 lines
                    
5
                    
6from test.test_support import verbose, unlink, import_module, run_unittest
                    
7
                    
8imageop = import_module('imageop', deprecated=True)
                    
9import uu, os, unittest
                    
10
                    
18
                    
19class InputValidationTests(unittest.TestCase):
                    
20
                    
64        # Issue #24264: Buffer overflow
                    
65        with self.assertRaises(imageop.error):
                    
66            imageop.grey2rgb('A'*256, 1, 129)
                    
69
                    
70    run_unittest(InputValidationTests)
                    
71
                    
                
test_hostvirtual.py https://gitlab.com/pooja043/Globus_Docker_1 | Python | 188 lines
                    
15import sys
                    
16import unittest
                    
17
                    
20from libcloud.compute.drivers.hostvirtual import HostVirtualNodeDriver
                    
21from libcloud.compute.types import NodeState
                    
22from libcloud.compute.base import NodeAuthPassword
                    
27
                    
28class HostVirtualTest(unittest.TestCase):
                    
29
                    
53        self.assertEqual(sizes[2].disk, '20GB')
                    
54        self.assertEqual(sizes[3].bandwidth, '600GB')
                    
55        self.assertEqual(sizes[1].price, '15.00')
                    
130        self.assertEqual('62291', node.id)
                    
131        self.assertEqual('server1.vr-cluster.org', node.name)
                    
132
                    
                
tests.py https://github.com/SmileyChris/django-old.git | Python | 264 lines
                    
3"""
                    
4from __future__ import absolute_import
                    
5
                    
15from django.utils import unittest
                    
16from django.utils.importlib import import_module
                    
17
                    
24
                    
25class DjangoTestRunnerTests(unittest.TestCase):
                    
26    def setUp(self):
                    
34    def test_failfast(self):
                    
35        class MockTestOne(unittest.TestCase):
                    
36            def runTest(self):
                    
53
                    
54class DependencyOrderingTests(unittest.TestCase):
                    
55
                    
                
tests.py https://bitbucket.org/Liosan/gizapi.git | Python | 391 lines
                    
6import time
                    
7import unittest
                    
8from cStringIO import StringIO
                    
14from django.core.files.uploadedfile import UploadedFile
                    
15from unittest import TestCase
                    
16
                    
32
                    
33class GetStorageClassTests(unittest.TestCase):
                    
34    def assertRaisesErrorWithMessage(self, error, message, callable,
                    
81
                    
82class FileStorageTests(unittest.TestCase):
                    
83    storage_class = FileSystemStorage
                    
235
                    
236class UnicodeFileNameTests(unittest.TestCase):
                    
237    def test_unicode_file_names(self):
                    
                
test_deregister.py https://gitlab.com/github-cloud-corp/aws-cli | Python | 193 lines
                    
16from awscli.customizations.codedeploy.deregister import Deregister
                    
17from awscli.testutils import unittest
                    
18
                    
19
                    
20class TestDeregister(unittest.TestCase):
                    
21    def setUp(self):
                    
73        self.args.instance_name = 'invalid%@^&%#&'
                    
74        with self.assertRaisesRegexp(
                    
75                ValueError, 'Instance name contains invalid characters.'):
                    
105        self.assertIn('tags', self.args)
                    
106        self.assertEquals(self.tags, self.args.tags)
                    
107        self.codedeploy.remove_tags_from_on_premises_instances.\
                    
128        self.assertIn('iam_user_arn', self.args)
                    
129        self.assertEquals(self.iam_user_arn, self.args.iam_user_arn)
                    
130        self.assertIn('user_name', self.args)
                    
                
test_script.py https://gitlab.com/yenny.prathivi/python-bitcoinlib | Python | 436 lines
                    
11
                    
12from __future__ import absolute_import, division, print_function, unicode_literals
                    
13
                    
13
                    
14import unittest
                    
15import os
                    
19
                    
20class Test_CScriptOp(unittest.TestCase):
                    
21    def test_pushdata(self):
                    
82
                    
83class Test_CScript(unittest.TestCase):
                    
84    def test_tokenize_roundtrip(self):
                    
429
                    
430class Test_IsLowDERSignature(unittest.TestCase):
                    
431    def test_high_s_value(self):
                    
                
test.py https://gitlab.com/CarlosRA97/py-leveldb | Python | 300 lines
                    
5
                    
6import sys, string, unittest, itertools
                    
7
                    
7
                    
8class TestLevelDB(unittest.TestCase):
                    
9	def setUp(self):
                    
9	def setUp(self):
                    
10		# import local leveldb
                    
11		import leveldb as _leveldb
                    
76		kv = list(db.RangeIter(key_from = None, key_to = None))
                    
77		self.assertEqual(kv, kv_)
                    
78
                    
79		kv = list(db.RangeIter(key_to = None))
                    
80		self.assertEqual(kv, kv_)
                    
81
                    
                
test_nl.py https://gitlab.com/github-cloud-corporation/pattern | Python | 273 lines
                    
2import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
                    
3import unittest
                    
4import subprocess
                    
14
                    
15class TestInflection(unittest.TestCase):
                    
16
                    
45        # Assert the accuracy of the attributive algorithm ("fel" => "felle").
                    
46        from pattern.db import Datasheet
                    
47        i, n = 0, 0
                    
138
                    
139class TestParser(unittest.TestCase):
                    
140    
                    
237
                    
238class TestSentiment(unittest.TestCase):
                    
239    
                    
                
test_text.py https://gitlab.com/unofficial-mirrors/cpython | Python | 236 lines
                    
4'''
                    
5import unittest
                    
6from test.support import requires
                    
93        get = self.text.get
                    
94        Equal = self.assertEqual
                    
95        self.text.insert('1.0', self.hw)
                    
141        get = self.text.get
                    
142        Equal = self.assertEqual
                    
143        self.text.insert('1.0', self.hw)
                    
193
                    
194class MockTextTest(TextTest, unittest.TestCase):
                    
195
                    
216
                    
217class TkTextTest(TextTest, unittest.TestCase):
                    
218
                    
                
test_contextlib.py https://gitlab.com/envieidoc/Clover | Python | 326 lines
                    
4import tempfile
                    
5import unittest
                    
6from contextlib import *  # Tests __all__
                    
13
                    
14class ContextManagerTestCase(unittest.TestCase):
                    
15
                    
108
                    
109class NestedTestCase(unittest.TestCase):
                    
110
                    
221
                    
222class ClosingTestCase(unittest.TestCase):
                    
223
                    
249
                    
250class FileContextTestCase(unittest.TestCase):
                    
251
                    
                
test_comparator.py https://gitlab.com/github-cloud-corp/aws-cli | Python | 235 lines
                    
13import datetime
                    
14import unittest
                    
15
                    
18from awscli.customizations.s3.comparator import Comparator
                    
19from awscli.customizations.s3.filegenerator import FileStat
                    
20
                    
21
                    
22class ComparatorTest(unittest.TestCase):
                    
23    def setUp(self):
                    
98            result_list.append(filename)
                    
99        self.assertEqual(result_list, ref_list)
                    
100
                    
107            result_list.append(filename)
                    
108        self.assertEqual(result_list, ref_list)
                    
109
                    
                
test_number.py https://gitlab.com/grayhamster/pycrypto | Python | 338 lines
                    
28
                    
29import sys
                    
30if sys.version_info[0] == 2 and sys.version_info[1] == 1:
                    
32
                    
33import unittest
                    
34from Crypto.SelfTest.st_common import assert_disabled
                    
41
                    
42class MiscTests(unittest.TestCase):
                    
43    def setUp(self):
                    
283
                    
284class FastmathTests(unittest.TestCase):
                    
285    def setUp(self):
                    
329    except ImportError:
                    
330        from Crypto.SelfTest.st_common import handle_fastmath_import_error
                    
331        handle_fastmath_import_error()
                    
                
testing.py https://gitlab.com/phongphans61/machine-learning-tictactoe | Python | 331 lines
                    
3from contextlib import contextmanager
                    
4from typing import Optional
                    
5
                    
5
                    
6from .core import (
                    
7    ParserElement,
                    
39                # assert that the '()' characters are not included in the parsed tokens
                    
40                self.assertParseAndCheckList(group, "(abc 123 def)", ['abc', '123', 'def'])
                    
41
                    
125        """
                    
126        A mixin class to add parse results assertion methods to normal unittest.TestCase classes.
                    
127        """
                    
138            if expected_dict is not None:
                    
139                self.assertEqual(expected_dict, result.as_dict(), msg=msg)
                    
140
                    
                
project_spec.py http://mobilegtd.googlecode.com/svn/trunk/ | Python | 327 lines
                    
1import unittest
                    
2from mock import Mock
                    
2from mock import Mock
                    
3import model.project
                    
4
                    
4
                    
5from model.project import Project
                    
6from model import project
                    
6from model import project
                    
7from model import action
                    
8
                    
9
                    
10class ProjectClassBehaviour(unittest.TestCase):
                    
11    def setUp(self):
                    
19
                    
20class ProjectBehaviour(unittest.TestCase):
                    
21
                    
                
test_schedule.py https://gitlab.com/xivo.solutions/xivo-agid | Python | 335 lines
                    
19import datetime
                    
20import unittest
                    
21
                    
28
                    
29class TestHoursChecker(unittest.TestCase):
                    
30    def test_range_is_in(self):
                    
138
                    
139class TestDaysChecker(unittest.TestCase):
                    
140    def test_simple_day(self):
                    
192
                    
193class TestSchedule(unittest.TestCase):
                    
194    def test_schedule_is_opened_when_hours_is_in_open_period(self):
                    
324
                    
325class TestScheduleAction(unittest.TestCase):
                    
326
                    
                
test_singleton.py http://ultra-finance.googlecode.com/svn/trunk/ | Python | 272 lines
                    
6'''
                    
7import unittest
                    
8import time
                    
10
                    
11class testSingleton(unittest.TestCase):
                    
12        def testReturnsSameObject(self):
                    
22            a2 = A.getInstance()
                    
23            self.assertEquals(id(a1), id(a2))
                    
24
                    
65
                    
66            self.assertRaises(SingletonException, B.getInstance)
                    
67
                    
105
                    
106            self.assertRaises(SingletonException, instantiatedAnIllegalClass)
                    
107
                    
                
adaptivescalar_test.py https://gitlab.com/github-cloud-corporation/nupic | Python | 257 lines
                    
23import tempfile
                    
24import unittest
                    
25
                    
25
                    
26import numpy
                    
27
                    
27
                    
28from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA
                    
29from nupic.encoders.adaptivescalar import AdaptiveScalarEncoder
                    
29from nupic.encoders.adaptivescalar import AdaptiveScalarEncoder
                    
30from nupic.encoders.base import defaultDtype
                    
31
                    
40
                    
41class AdaptiveScalarTest(unittest.TestCase):
                    
42  """Tests for AdaptiveScalarEncoder"""
                    
                
plugin_tests.py https://gitlab.com/pbandark/sos | Python | 341 lines
                    
1import unittest
                    
2import os
                    
94
                    
95class PluginToolTests(unittest.TestCase):
                    
96
                    
127
                    
128class PluginTests(unittest.TestCase):
                    
129
                    
219
                    
220class AddCopySpecTests(unittest.TestCase):
                    
221
                    
283
                    
284class CheckEnabledTests(unittest.TestCase):
                    
285
                    
310
                    
311class RegexSubTests(unittest.TestCase):
                    
312
                    
                
test_mutable_list.py https://bitbucket.org/ssaltzman/poet.git | Python | 399 lines
                    
6from django.contrib.gis.geos.mutable_list import ListMixin
                    
7from django.utils import unittest
                    
8
                    
46
                    
47class ListMixinTest(unittest.TestCase):
                    
48    """
                    
69        for i in self.limits_plus(1):
                    
70            self.assertEqual(pl[i:], ul[i:], 'slice [%d:]' % (i))
                    
71            self.assertEqual(pl[:i], ul[:i], 'slice [:%d]' % (i))
                    
73            for j in self.limits_plus(1):
                    
74                self.assertEqual(pl[i:j], ul[i:j], 'slice [%d:%d]' % (i,j))
                    
75                for k in self.step_range():
                    
75                for k in self.step_range():
                    
76                    self.assertEqual(pl[i:j:k], ul[i:j:k], 'slice [%d:%d:%d]' % (i,j,k))
                    
77
                    
                
gmock_class_test.py https://gitlab.com/stuckyb/fastpcm | Python | 466 lines
                    
24import sys
                    
25import unittest
                    
26
                    
30from cpp import ast
                    
31from cpp import gmock_class
                    
32
                    
33
                    
34class TestCase(unittest.TestCase):
                    
35  """Helper class that adds assert methods."""
                    
192"""
                    
193    self.assertEqualIgnoreLeadingWhitespace(
                    
194        'MOCK_METHOD2(Bar,\nvoid(int, char));',
                    
204"""
                    
205    self.assertEqualIgnoreLeadingWhitespace(
                    
206        'MOCK_METHOD2(Bar,\nvoid(int, char));',
                    
                
_test_caching.py https://gitlab.com/Acidburn0zzz/hyperkitty | Python | 237 lines
                    
3
                    
4from __future__ import absolute_import, print_function, unicode_literals
                    
5
                    
5
                    
6import unittest
                    
7import datetime
                    
20
                    
21class ListCacheTestCase(unittest.TestCase):
                    
22
                    
75
                    
76class UserIdCacheTestCase(unittest.TestCase):
                    
77
                    
167
                    
168class TestNotifyStore(unittest.TestCase):
                    
169    def setUp(self):
                    
                
web_ui.py https://github.com/edgewall/trac.git | Python | 222 lines
                    
14import re
                    
15import unittest
                    
16
                    
24
                    
25class DefaultWikiPolicyTestCase(unittest.TestCase):
                    
26
                    
65
                    
66class WikiModuleTestCase(unittest.TestCase):
                    
67
                    
138        self.assertEqual('wiki_view.html', resp[0])
                    
139        self.assertIsNone(resp[1]['version'])
                    
140        self.assertEqual('NewPage', resp[1]['page'].name)
                    
216    suite.addTest(unittest.makeSuite(DefaultWikiPolicyTestCase))
                    
217    suite.addTest(unittest.makeSuite(WikiModuleTestCase))
                    
218    return suite
                    
                
test_migrations.py https://gitlab.com/noc0lour/mailman | Python | 298 lines
                    
20import os
                    
21import unittest
                    
22import sqlalchemy as sa
                    
24
                    
25from mailman.app.lifecycle import create_list
                    
26from mailman.config import config
                    
38
                    
39class TestMigrations(unittest.TestCase):
                    
40    layer = ConfigLayer
                    
161        for i in range(1, 5):
                    
162            self.assertIn('type', results[i])
                    
163        self.assertEqual(results[1]['type'], 'probe')
                    
223            os.path.join(config.LIST_DATA_DIR, 'ant@example.com')))
                    
224        self.assertTrue(os.path.exists(ant.data_path))
                    
225        self.assertTrue(os.path.exists(bee.data_path))
                    
                
test_capabilities.py https://github.com/twleung/mac-mysql-python.git | Python | 269 lines
                    
7"""
                    
8from time import time
                    
9import array
                    
9import array
                    
10import unittest
                    
11
                    
12
                    
13class DatabaseTest(unittest.TestCase):
                    
14
                    
81            print l
                    
82        self.assertEquals(len(l), self.rows)
                    
83        try:
                    
85                for j in range(len(columndefs)):
                    
86                    self.assertEquals(l[i][j], generator(i,j))
                    
87        finally:
                    
                
test_play_context.py https://gitlab.com/0072016/Facebook-SDK-json- | Python | 308 lines
                    
18# Make coding more python3-ish
                    
19from __future__ import (absolute_import, division, print_function)
                    
20__metaclass__ = type
                    
21
                    
22import os
                    
23
                    
23
                    
24from ansible.compat.tests import unittest
                    
25from ansible.compat.tests.mock import patch, MagicMock
                    
33
                    
34class TestPlayContext(unittest.TestCase):
                    
35
                    
173
                    
174class TestTaskAndVariableOverrride(unittest.TestCase):
                    
175
                    
                
odict_mapping.py https://gitlab.com/Rockyspade/astropy | Python | 311 lines
                    
2
                    
3import unittest
                    
4
                    
4
                    
5from . import odict_support as test_support
                    
6
                    
7
                    
8class BasicTestMappingProtocol(unittest.TestCase):
                    
9    # This base class can be used to check that an object conforms to the
                    
31    def __init__(self, *args, **kw):
                    
32        unittest.TestCase.__init__(self, *args, **kw)
                    
33        self.reference = self._reference().copy()
                    
52        for key, value in self.reference.items():
                    
53            self.assertEqual(d[key], value)
                    
54        knownkey = self.other.keys()[0]
                    
                
test_events_state.py https://github.com/rlotun/celery.git | Python | 289 lines
                    
1from time import time
                    
2import unittest2 as unittest
                    
3
                    
3
                    
4from itertools import count
                    
5
                    
80
                    
81class test_Worker(unittest.TestCase):
                    
82
                    
88
                    
89class test_Task(unittest.TestCase):
                    
90
                    
122
                    
123class test_State(unittest.TestCase):
                    
124
                    
                
 

Source

Language