100+ results for '"import unittest" unittest.TestCase self.assert lang:Python'

Not the results you expected?

test_qgsgraph.py (https://github.com/ricardogsilva/Quantum-GIS.git) Python · 335 lines

12

13 import qgis # NOQA

14 from qgis.analysis import (

16 )

17 from qgis.core import (

18 QgsPointXY

19 )

20 from qgis.testing import start_app, unittest

21

24

25 class TestQgsGraph(unittest.TestCase):

26

28 graph = QgsGraph()

29 self.assertEqual(graph.vertexCount(), 0)

30 self.assertEqual(graph.edgeCount(), 0)

test_int_literal.py (https://github.com/nmacherey/rheia.git) Python · 191 lines

5

6 import unittest

7 from test import test_support

8

9 import warnings

10 warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,

12

13 class TestHexOctBin(unittest.TestCase):

14

16 # A few upper/lowercase tests

17 self.assertEqual(0x0, 0X0)

18 self.assertEqual(0x1, 0X1)

19 self.assertEqual(0x123456789abcdef, 0X123456789abcdef)

20 # Baseline tests

test_variables.py (https://gitlab.com/abhi1tb/build) Python · 310 lines

1 import unittest

2 import gc

3 from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,

4 TclError)

16

17 class 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))

308 if __name__ == "__main__":

309 from test.support import run_unittest

310 run_unittest(*tests_gui)

PRESUBMIT_test.py (https://github.com/chromium/chromium.git) Python · 231 lines

7 import sys

8 import unittest

9

16

17 class CheckNotificationConstructors(unittest.TestCase):

18 """Test the _CheckNotificationConstructors presubmit check."""

59

60 class CheckAlertDialogBuilder(unittest.TestCase):

61 """Test the _CheckAlertDialogBuilder presubmit check."""

125

126 class CheckCompatibleAlertDialogBuilder(unittest.TestCase):

127 """Test the _CheckCompatibleAlertDialogBuilder presubmit check."""

178

179 class CheckBundleUtilsIdentifierName(unittest.TestCase):

180 """Test the _CheckBundleUtilsIdentifierName presubmit check."""

test_siemens.py (https://github.com/icometrix/dicom2nifti.git) Python · 206 lines

9 import tempfile

10 import unittest

11

12 import nibabel

13 import numpy

26

27 class TestConversionSiemens(unittest.TestCase):

28 def test_diffusion_imaging(self):

44 ground_thruth_filenames(test_data.SIEMENS_DTI)[0])

45 self.assertTrue(isinstance(results['NII'], nibabel.nifti1.Nifti1Image))

46 assert_compare_bval(results['BVAL_FILE'],

56 ground_thruth_filenames(test_data.SIEMENS_DTI_IMPLICIT)[0])

57 self.assertTrue(isinstance(results['NII'], nibabel.nifti1.Nifti1Image))

58 assert_compare_bval(results['BVAL_FILE'],

test_events.py (https://gitlab.com/goolic/pyramid) Python · 301 lines

1 import unittest

2 from pyramid import testing

3

4 class NewRequestEventTests(unittest.TestCase):

5 def _getTargetClass(self):

29

30 class NewResponseEventTests(unittest.TestCase):

31 def _getTargetClass(self):

91

92 class ContextFoundEventTests(unittest.TestCase):

93 def _getTargetClass(self):

126

127 class TestSubscriber(unittest.TestCase):

128 def setUp(self):

202

203 class TestBeforeRender(unittest.TestCase):

204 def _makeOne(self, system, val=None):

tests.py (https://bitbucket.org/zozo123/fuzzywuzzy.git) Python · 285 lines

7 import itertools

8 import unittest

9

10 class UtilsTest(unittest.TestCase):

11 def setUp(self):

46

47 class RatioTest(unittest.TestCase):

48

171

172 class ProcessTest(unittest.TestCase):

173

247 self.assertTrue(best is None)

248 #self.assertIsNone(best) # unittest.TestCase did not have assertIsNone until Python 2.7

249

update_parser_test.py (https://github.com/sburnett/bismark-passive-server.git) Python · 282 lines

1 import update_parser

2

3 import calendar

4 import unittest

5

8

9 class TestParser(unittest.TestCase):

10 def test_unanonymized_header(self):

26 update = update_parser.PassiveUpdate(format_source(source))

27 self.assertTrue(update.file_format_version == 9)

28 self.assertTrue(update.build_id == 'BUILDID')

29 self.assertTrue(update.bismark_id == 'BISMARKID')

30 self.assertTrue(update.creation_time == 1234567890)

31 self.assertTrue(update.sequence_number == 12)

32 self.assertTrue(calendar.timegm(update.timestamp.timetuple()) == 98765)

test_qgsnumericformat.py (https://github.com/ricardogsilva/Quantum-GIS.git) Python · 801 lines

12

13 import qgis # NOQA

14

15 from qgis.core import (QgsFallbackNumericFormat,

16 QgsBasicNumericFormat,

25 QgsReadWriteContext)

26 from qgis.testing import start_app, unittest

27 from qgis.PyQt.QtXml import QDomDocument

52

53 class TestQgsNumericFormat(unittest.TestCase):

54

58 context = QgsNumericFormatContext()

59 self.assertEqual(f.formatDouble(5, context), '5')

60 self.assertEqual(f.formatDouble(5.5, context), '5.5')

test_plot3d.py (https://github.com/thearn/OpenMDAO-Framework.git) Python · 214 lines

6 import os.path

7 import tempfile

8 import shutil

9 import unittest

10

11 from openmdao.lib.datatypes.domain import read_plot3d_q, write_plot3d_q, \

12 read_plot3d_f, write_plot3d_f, \

20

21 class TestCase(unittest.TestCase):

22 """ Test Plot3D operations on :class:`DomainObj` objects. """

156 test_flow = domain.zone_1.flow_solution

157 self.assertTrue((test_flow.f_1 == wedge_flow.density).all())

158 self.assertTrue((test_flow.f_2 == wedge_flow.momentum.x).all())

test_shell.py (https://github.com/jackingod/mongo.git) Python · 239 lines

23

24 import unittest

25 import sys

26 import subprocess

27 import os

35

36 class TestShell(unittest.TestCase):

37

53 out = mongo_h.communicate()

54 self.assertEqual(out, mongo_help.communicate())

55 self.assert_("usage:" in out[0])

56

57 self.assertEqual(0, mongo_h.returncode)

58 self.assertEqual(0, mongo_help.returncode)

test_principals.py (https://github.com/plone/plone.app.vocabularies.git) Python · 490 lines

1 # -*- coding: utf-8 -*-

2 from plone.app.vocabularies.testing import PAVocabularies_INTEGRATION_TESTING

3

4 import mock

5 import unittest

6

7

8 class PrincipalsTest(unittest.TestCase):

9 layer = PAVocabularies_INTEGRATION_TESTING

23 def test_empty_principals_vocabulary(self):

24 from plone.app.vocabularies.principals import PrincipalsVocabulary

25

29 # basic data

30 self.assertEqual(vocab.principal_source, 'user')

31 self.assertEqual(vocab._acl_users, self.portal['acl_users'])

test_pcreate.py (https://github.com/ledmonster/pyramid.git) Python · 244 lines

1 import unittest

2

3 class TestPCreateCommand(unittest.TestCase):

4 def setUp(self):

5 from pyramid.compat import NativeIO

6 self.out_ = NativeIO()

11 def _getTargetClass(self):

12 from pyramid.scripts.pcreate import PCreateCommand

13 return PCreateCommand

24 result = cmd.run()

25 self.assertEqual(result, 0)

26 out = self.out_.getvalue()

223

224 class Test_main(unittest.TestCase):

225 def _callFUT(self, argv):

test_routes.py (https://github.com/xaav/pyramid.git) Python · 223 lines

1 import unittest

2

3 from pyramid.tests.test_config import dummyfactory

4 from pyramid.tests.test_config import DummyContext

5

6 class RoutesConfiguratorMixinTests(unittest.TestCase):

7 def _makeOne(self, *arg, **kw):

8 from pyramid.config import Configurator

9 config = Configurator(*arg, **kw)

12 def _assertRoute(self, config, name, path, num_predicates=0):

13 from pyramid.interfaces import IRoutesMapper

14 mapper = config.registry.getUtility(IRoutesMapper)

85 request.is_xhr = True

86 self.assertEqual(predicate(None, request), True)

87 request = self._makeRequest(config)

test_recipients.py (https://gitlab.com/yamhill/mailman) Python · 202 lines

19

20 import unittest

21

27 configuration, specialized_message_from_string as mfs)

28 from mailman.testing.layers import ConfigLayer

29 from zope.component import getUtility

31

32 class TestMemberRecipients(unittest.TestCase):

33 """Test regular member recipient calculation."""

82

83 class 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_bus.py (https://github.com/theosp/google_appengine.git) Python · 263 lines

2 import time

3 import unittest

4

12

13 class PublishSubscribeTests(unittest.TestCase):

14

72

73 class 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)]))

167 # The exit method MUST log its states.

168 self.assertLog(['Bus STOPPING', 'Bus STOPPED', 'Bus EXITING', 'Bus EXITED'])

169

testArray.py (https://github.com/WeatherGod/numpy.git) Python · 284 lines

1 #! /usr/bin/env python

2 from __future__ import division, absolute_import, print_function

3

7 import sys

8 import unittest

9

21

22 class Array1TestCase(unittest.TestCase):

23

95 "Test Array1 __getitem__ method, negative index"

96 self.assertRaises(IndexError, self.array1.__getitem__, -1)

97

121

122 class Array2TestCase(unittest.TestCase):

123

ApplyPaalmanPingsCorrectionTest.py (https://github.com/wdzhou/mantid.git) Python · 195 lines

1 from __future__ import (absolute_import, division, print_function)

2

3 import unittest

4 from mantid.kernel import *

5 from mantid.api import *

6 from mantid.simpleapi import (CreateWorkspace, Load, ConvertUnits,

8 DeleteWorkspace)

9 import numpy

10

11

12 class ApplyPaalmanPingsCorrectionTest(unittest.TestCase):

13

70 x_unit = ws.getAxis(0).getUnit().unitID()

71 self.assertEquals(x_unit, 'Wavelength')

72

test.py (https://github.com/brynmathias/AnalysisV2.git) Python · 352 lines

1 #!/usr/bin/env python

2 import unittest

3

11

12 class MuonTestCase(unittest.TestCase, WPolTestCase):

13 def setUp(self):

77 self.assertWithinErrors("fR", fR_fit, fR_nom, fR_err)

78 self.assertWithinErrors("f0", f0_fit, f0_nom, f0_err)

79

163

164 class EleTestCase(unittest.TestCase, WPolTestCase):

165 def setUp(self):

261 self.assertWithinErrors("fL", fL_fit, fL_nom, fL_err)

262 self.assertWithinErrors("fR", fR_fit, fR_nom, 3*fR_err)

263 self.assertWithinErrors("f0", f0_fit, f0_nom, f0_err)

test_world.py (https://github.com/mmcgill/bravo.git) Python · 238 lines

1 from twisted.trial import unittest

2

14

15 class TestWorldChunks(unittest.TestCase):

16

67 metadata = yield self.w.get_metadata((x, y, z))

68 self.assertEqual(metadata, chunk.get_metadata((x, y, z)))

69

131 metadata = yield self.w.get_metadata((x, y, z))

132 self.assertEqual(metadata, chunk.get_metadata((x, y, z)))

133

200

201 class TestWorld(unittest.TestCase):

202

236 def cb(player):

237 self.assertEqual(player.username, "unittest")

238 return d

iq.py (https://github.com/kulikov/python-tools.git) Python · 208 lines

4

5 import unittest

6

7 from pyxmpp2.etree import ElementTree

8

9 from pyxmpp2.iq import Iq

10 from pyxmpp2.jid import JID

11 from pyxmpp2.stanzapayload import XMLPayload

12 from pyxmpp2.error import StanzaErrorElement

44

45 class TestIq(unittest.TestCase):

46 def check_iq1(self, iq):

test_knspace.py (https://github.com/akshayaurora/kivy.git) Python · 247 lines

1

2 import unittest

3 '''ACHTUNG: when testing, never re-use widget names, otherwise the tests

7

8 class KNSpaceTestCase(unittest.TestCase):

9

10 def test_not_exists(self):

11 from kivy.uix.behaviors.knspace import knspace

12 self.assertRaises(AttributeError, lambda: knspace.label)

14 def test_not_exists_property(self):

15 from kivy.uix.behaviors.knspace import knspace

16 self.assertRaises(AttributeError, lambda: knspace.label2)

17 knspace.property('label2')

18 self.assertIsNone(knspace.label2)

19

test_nexus_plugin.py (https://github.com/rnirmal/quantum.git) Python · 286 lines

17 import logging

18 import unittest

19 from quantum.common import exceptions as exc

20 from quantum.plugins.cisco.common import cisco_constants as const

21 from quantum.plugins.cisco.db import l2network_db as cdb

22 from quantum.plugins.cisco.db import api as db

27

28 class TestNexusPlugin(unittest.TestCase):

29

78 self.assertEqual(new_net_dict[const.NET_NAME], self.net_name)

79 self.assertEqual(new_net_dict[const.NET_VLAN_NAME], self.vlan_name)

80 self.assertEqual(new_net_dict[const.NET_VLAN_ID], self.vlan_id)

103 tenant_id, new_net_dict[const.NET_ID])

104 self.assertEqual(deleted_net_dict[const.NET_ID], net_id)

105 LOG.debug("test_delete_network - END")

test_tableworkspacedisplay_marked_columns.py (https://github.com/mantidproject/mantid.git) Python · 360 lines

9 #

10 import unittest

11 from itertools import permutations

12

13 from mantidqt.widgets.workspacedisplay.table.error_column import ErrorColumn

14 from mantidqt.widgets.workspacedisplay.table.marked_columns import MarkedColumns

22

23 class MarkedColumnsTest(unittest.TestCase):

24

34 func_to_add(2)

35 self.assertEqual(1, len(list_to_check))

36 func_to_add(3)

37 self.assertEqual(2, len(list_to_check))

38 func_to_add(4000000)

bencode_tests.py (https://gitlab.com/lukaf/python-bittorrent) Python · 464 lines

6

7 class Walk(unittest.TestCase):

8 """ Check the function walk() works correctly. """

99

100 class Ben_Type(unittest.TestCase):

101 """ Check the function ben_type() works correctly. """

375

376 class Decode_Dict(unittest.TestCase):

377 """ Check the function decode_dict() works correctly. """

407

408 class Encode(unittest.TestCase):

409 """ Check the encode() function works. As this dispatches to the other

436

437 class Decode(unittest.TestCase):

438 """ Check the decode() function works. As this dispatches to the other

test_steps_shellsequence.py (https://gitlab.com/murder187ss/buildbot) Python · 149 lines

14 # Copyright Buildbot Team Members

15 from twisted.trial import unittest

16

18 from buildbot.process.results import EXCEPTION

19 from buildbot.process.results import FAILURE

20 from buildbot.process.results import SUCCESS

21 from buildbot.process.results import WARNINGS

22 from buildbot.steps import shellsequence

23 from buildbot.test.fake.remotecommand import Expect

24 from buildbot.test.fake.remotecommand import ExpectShell

25 from buildbot.test.util import config as configmixin

34

35 class TestOneShellCommand(steps.BuildStepMixin, unittest.TestCase, configmixin.ConfigErrorsMixin):

36

test_qgsbookmarkmodel.py (https://github.com/ricardogsilva/Quantum-GIS.git) Python · 248 lines

12

13 import qgis # NOQA

14

15 from qgis.PyQt.QtCore import Qt, QCoreApplication, QLocale

16

17 from qgis.core import (QgsBookmark,

18 QgsBookmarkManager,

25

26 from qgis.testing import start_app, unittest

27 from utilities import unitTestDataPath

32

33 class TestQgsBookmarkManagerModel(unittest.TestCase):

34

testMatrix.py (https://github.com/njsmith/numpy.git) Python · 362 lines

1 #! /usr/bin/env python

2 from __future__ import division, absolute_import, print_function

3

4 # System imports

5 from distutils.util import get_platform

7 import sys

8 import unittest

9

19

20 class MatrixTestCase(unittest.TestCase):

21

22 def __init__(self, methodName="runTests"):

23 unittest.TestCase.__init__(self, methodName)

24 self.typeStr = "double"

test_player.py (https://github.com/FrancescAlted/pelita.git) Python · 196 lines

1 import unittest

2 from pelita.player import *

3 from pelita.datamodel import create_CTFUniverse, north, stop, east

4 from pelita.game_master import GameMaster

6

7 class TestAbstractPlayer(unittest.TestCase):

8

69

70 class TestNQRandom_Player(unittest.TestCase):

71 def test_demo_players(self):

82

83 class TestBFS_Player(unittest.TestCase):

84

139

140 class TestSimpleTeam(unittest.TestCase):

141

test_qgsmaplayerproxymodel.py (https://github.com/ricardogsilva/Quantum-GIS.git) Python · 331 lines

12

13 import qgis # NOQA

14

15 from qgis.core import (

16 QgsVectorLayer,

22 )

23 from qgis.PyQt.QtCore import Qt, QModelIndex

24

25 from qgis.testing import start_app, unittest

26

40

41 class TestQgsMapLayerProxyModel(unittest.TestCase):

42

IndirectFlatPlateAbsorption2Test.py (https://github.com/mantidproject/mantid.git) Python · 164 lines

6 # SPDX - License - Identifier: GPL - 3.0 +

7 import unittest

8 from mantid.simpleapi import LoadNexusProcessed, IndirectFlatPlateAbsorption, DeleteWorkspace

9 from mantid.api import *

10

11

12 class IndirectFlatPlateAbsorption2Test(unittest.TestCase):

13 def setUp(self):

40 corrected_x_unit = corrected.getAxis(0).getUnit().unitID()

41 self.assertEqual(corrected_x_unit, 'DeltaE')

42

48 y_unit = ws.YUnitLabel()

49 self.assertEqual(y_unit, 'Attenuation factor')

50

convert_test.py (https://github.com/beancount/beancount.git) Python · 321 lines

7 import datetime

8 import unittest

9

37

38 class TestPositionConversions(unittest.TestCase):

39 """Test conversions to units, cost, weight and market-value for Position objects."""

129 pos = self._pos(A("100 HOOL"), None)

130 self.assertEqual(A("100 HOOL"),

131 convert.get_value(pos, self.PRICE_MAP_EMPTY))

251

252 class TestMarketValue(unittest.TestCase):

253

292 datetime.date(2013, 6, 6))

293 self.assertEqual(inventory.from_string('100 USD, 90 CAD'), market_value)

294

test_pep3118.py (https://gitlab.com/pmuontains/Odoo) Python · 203 lines

1 import unittest

2 from ctypes import *

19

20 class Test(unittest.TestCase):

21

26 try:

27 self.assertEqual(normalize(v.format), normalize(fmt))

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_mbxml.py (https://github.com/lalinsky/picard.git) Python · 429 lines

2

3 import unittest

4 import picard

5 from picard import config

6 from picard.metadata import Metadata

43

44 class TrackTest(unittest.TestCase):

45

93

94 class ReleaseTest(unittest.TestCase):

95

148

149 class ArtistTest(unittest.TestCase):

150

test_cases.py (https://github.com/lmorchard/home-snippets-server-lib.git) Python · 252 lines

1 import unittest

2 import pdb

118

119 class TC(unittest.TestCase):

120 def setUp(self):

137 """A result proxy is used to wrap the result for all tests"""

138 class TC(unittest.TestCase):

139 def runTest(self):

157 from nose.util import absfile, src

158 class TC(unittest.TestCase):

159 def runTest(self):

206 def test_context(self):

207 class TC(unittest.TestCase):

208 def runTest(self):

226 def test_short_description(self):

227 class TC(unittest.TestCase):

228 def test_a(self):

hid_gadget_test.py (https://github.com/chromium/chromium.git) Python · 258 lines

5

6 import unittest

7

47

48 class 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

137 class HidFeatureTest(unittest.TestCase):

138

167 g.Connected(chip, usb_constants.Speed.HIGH)

168 self.assertIsNone(g.ControlWrite(0x21, 0x09, 0x0102, 0, 'Hello!'))

169

tests.py (https://github.com/disko/pyramid_formalchemy.git) Python · 269 lines

1 import unittest2 as unittest

2 from pyramid.config import Configurator

4 from sqlalchemy.orm import scoped_session

5 from sqlalchemy.orm import sessionmaker

6

7 from zope.sqlalchemy import ZopeTransactionExtension

8

20

21 class Test_1_UI(unittest.TestCase):

22

37 resp = self.app.get('/admin')

38 self.assertEqual(resp.status_int, 302)

39 assert '/admin/' in resp.location, resp

210 resp = self.app.get('/admin/Bar', status=403, extra_environ={'REMOTE_USER': 'editor'})

211 self.assertEqual(resp.status_int, 403)

212

test_slots.py (https://github.com/mmcgill/bravo.git) Python · 271 lines

31

32 class TestCraftingInternals(unittest.TestCase):

33 def setUp(self):

156

157 class TestWorkbenchInternals(unittest.TestCase):

158 def setUp(self):

164

165 class TestCraftingShovel(unittest.TestCase):

166 """

209

210 class TestCraftingFurnace(unittest.TestCase):

211 """

254

255 class TestChestSerialization(unittest.TestCase):

256 def setUp(self):

test_winsound.py (https://github.com/tmacreturns/XBMC_wireless_setup.git) Python · 209 lines

2

3 import unittest

4 from test import test_support

9

10 class BeepTest(unittest.TestCase):

11

12 def test_errors(self):

13 self.assertRaises(TypeError, winsound.Beep)

14 self.assertRaises(ValueError, winsound.Beep, 36, 75)

24

25 class MessageBeepTest(unittest.TestCase):

26

50

51 class PlaySoundTest(unittest.TestCase):

52

test_pep292.py (https://github.com/nmacherey/rheia.git) Python · 194 lines

4

5 import unittest

6 from string import Template

22

23 class TestTemplate(unittest.TestCase):

24 def test_regular_templates(self):

27 'tim likes to eat a bag of ham worth $100')

28 self.assertRaises(KeyError, s.substitute, dict(who='tim'))

29

45 def test_percents(self):

46 eq = self.assertEqual

47 s = Template('%(foo)s $foo ${foo}')

80 def test_invalid_placeholders(self):

81 raises = self.assertRaises

82 s = Template('$who likes $')

test_text.py (https://github.com/akheron/cpython.git) Python · 236 lines

4 '''

5 import unittest

6 from 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

194 class MockTextTest(TextTest, unittest.TestCase):

195

216

217 class TkTextTest(TextTest, unittest.TestCase):

218

test_protocol.py (https://github.com/thirumg/Avro.NET.git) Python · 257 lines

18 """

19 import unittest

20 from avro import protocol

174

175 class TestProtocol(unittest.TestCase):

176 def test_parse(self):

195 (num_correct, len(EXAMPLES))

196 self.assertEqual(num_correct, len(EXAMPLES), fail_msg)

197

221 (num_correct, len(VALID_EXAMPLES))

222 self.assertEqual(num_correct, len(VALID_EXAMPLES), fail_msg)

223

253 (num_correct, len(VALID_EXAMPLES))

254 self.assertEqual(num_correct, len(VALID_EXAMPLES), fail_msg)

255

unit-writemozinfo.py (https://github.com/diogogmt/mozilla-central.git) Python · 243 lines

2 from __future__ import with_statement

3 import unittest

4 import os, sys, time, tempfile

10

11 class TestBuildDict(unittest.TestCase):

12 def testMissing(self):

162

163 class TestJsonValue(unittest.TestCase):

164 def testNone(self):

186

187 class TestJsonify(unittest.TestCase):

188 """

201

202 class TestWriteJson(unittest.TestCase):

203 """

stencil_cache_block_test.py (https://github.com/richardxia/asp.git) Python · 195 lines

1 import unittest2 as unittest

2 from asp.codegen.cpp_ast import *

6

7 class StencilConvertASTTests(unittest.TestCase):

8 def setUp(self):

38 for y in xrange(1,128):

39 self.assertAlmostEqual(self.out_grid[x,y], 4.0)

40

52 for z in xrange(1,128):

53 self.assertAlmostEqual(self.out_grid[x,y,z], 6.0)

54

56

57 class StencilConvertASTBlockedTests(unittest.TestCase):

58 def setUp(self):

88

89 class CacheBlockerTests(unittest.TestCase):

90 def test_2d(self):

test_data_changesources.py (https://gitlab.com/murder187ss/buildbot) Python · 232 lines

18 from twisted.python import failure

19 from twisted.trial import unittest

20

28

29 class ChangeSourceEndpoint(endpoint.EndpointMixin, unittest.TestCase):

30

67 self.validateData(changesource)

68 self.assertEqual(changesource['master'], None),

69 return d

108

109 class ChangeSourcesEndpoint(endpoint.EndpointMixin, unittest.TestCase):

110

160

161 class ChangeSource(interfaces.InterfaceTests, unittest.TestCase):

162

RequestInfoCollection_t.py (https://github.com/dmwm/WMCore.git) Python · 190 lines

2 """

3 Unittests for the RequestInfoCollection WMStats module

4 """

5 from __future__ import division, print_function

6

7 import unittest

8

31

32 class MyTestCase(unittest.TestCase):

33

35 if PY3:

36 self.assertItemsEqual = self.assertCountEqual

37

test.py (https://github.com/GunioRobot/ibus-skk.git) Python · 936 lines

3 from __future__ import with_statement

4 import unittest

5 import os, os.path

6 import skk

7 import nicola

8 from ibus import modifier

9

10 class TestSKK(unittest.TestCase):

11 def setUp(self):

50 usrdict = skk.UsrDict(usrdict_path, 'UTF-8')

51 self.assertNotEqual(usrdict, None)

52 self.assertTrue(usrdict.read_only)

test_wsgi.py (https://github.com/athanatos/glance.git) Python · 184 lines

17

18 import unittest

19 import webob

24

25 class RequestTest(unittest.TestCase):

26 def test_content_type_missing(self):

74

75 class ResourceTest(unittest.TestCase):

76 def test_get_action_args(self):

123

124 class JSONResponseSerializerTest(unittest.TestCase):

125 def test_to_json(self):

139

140 class JSONRequestDeserializerTest(unittest.TestCase):

141 def test_has_body_no_content_length(self):

json3_output_unittest.py (https://github.com/chromium/chromium.git) Python · 205 lines

5 import copy

6 import unittest

7

8 from core.results_processor.formatters import json3_output

9 from core.results_processor import testing

11

12 class 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]

test_codeop.py (https://github.com/rpattabi/ironruby.git) Python · 310 lines

5 import unittest

6 from test.test_support import run_unittest, is_jython, due_to_ironpython_bug, is_cli

7

10 if is_jython:

11 import sys

12 import cStringIO

19

20 class CodeopTests(unittest.TestCase):

21

59 def test_valid(self):

60 av = self.assertValid

61

69 PyCF_DONT_IMPLY_DEDENT))

70 self.assertEquals(compile_command("\n"),

71 compile("pass", "<input>", 'single',

test_util.py (https://github.com/cameronr/pyramid.git) Python · 338 lines

1 import unittest

2

3 class Test__make_predicates(unittest.TestCase):

4 def _callFUT(self, **kw):

5 from pyramid.config.util import make_predicates

6 return make_predicates(**kw)

10 order2, _, _ = self._callFUT(containment=True)

11 self.assertTrue(order1 < order2)

12

102 )

103 self.assertEqual(order1, order2)

104 self.assertTrue(order3 > order2)

105 self.assertTrue(order4 > order3)

106 self.assertTrue(order5 > order4)

test_with_pandas.py (https://gitlab.com/github-cloud-corporation/xgboost) Python · 176 lines

1 # -*- coding: utf-8 -*-

2 import numpy as np

3 import xgboost as xgb

4 import testing as tm

5 import unittest

6

7 try:

8 import pandas as pd

9 except ImportError:

19

20 class 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

gpu_test_expectations_unittest.py (https://gitlab.com/jonnialva90/iridium-browser) Python · 183 lines

3 # found in the LICENSE file.

4 import unittest

5

9

10 import gpu_test_expectations

11

71

72 class GpuTestExpectationsTest(unittest.TestCase):

73 def setUp(self):

123 StubPlatform('mac'), VENDOR_AMD, 0x1001)

124 self.assertExpectationEquals('pass', page,

125 StubPlatform('win'), VENDOR_AMD, 0x1002)

130 page = page_module.Page('http://test.com/test4.html', ps)

131 self.assertExpectationEquals('fail', page,

132 vendor_string=VENDOR_STRING_IMAGINATION,

test_strlit.py (https://bitbucket.org/kbengine/kbengine.git) Python · 186 lines

29

30 import os

31 import sys

32 import shutil

33 import tempfile

34 import unittest

35 import test.support

63

64 class TestLiterals(unittest.TestCase):

65

81 def test_eval_str_normal(self):

82 self.assertEqual(eval(""" 'x' """), 'x')

83 self.assertEqual(eval(r""" '\x01' """), chr(1))

test_log.py (https://github.com/coderanger/celery.git) Python · 208 lines

4 import logging

5 import unittest2 as unittest

6 from tempfile import mktemp

47

48 class test_default_logger(unittest.TestCase):

49

77 root=False)

78 self.assertIs(get_handlers(logger)[0].stream, sys.__stderr__,

79 "setup_logger logs to stderr without logfile argument.")

92 l.info("The quick brown fox...")

93 self.assertIn("The quick brown fox...", stderr.getvalue())

94

165

166 class test_CompatLoggerAdapter(unittest.TestCase):

167 levels = ("debug",

ext_version.py (https://github.com/kulikov/python-tools.git) Python · 181 lines

4

5 import unittest

6 import platform

7

8 from pyxmpp2.etree import ElementTree

9

32

33 class TestVersionPayload(unittest.TestCase):

34 def test_parse_empty(self):

64

65 class TestVersionProvider(unittest.TestCase):

66 def test_defaults(self):

115

116 class TestVersionRequest(unittest.TestCase):

117 def test_request(self):

testreducegip.py (https://bitbucket.org/mapdes/ffc.git) Python · 240 lines

23 # Pyhton modules

24 import unittest

25 import time

27 # FFC modules

28 from ffc.quadrature.symbolics import *

29 from ffc.cpp import format, set_float_formatting

30 from ffc.parameters import FFC_PARAMETERS

31 set_float_formatting(FFC_PARAMETERS['precision'])

32

33 class TestReduceGIP(unittest.TestCase):

34

228

229 self.assertAlmostEqual(eval(str(expr)), eval(str(expr_exp)))

230 self.assertAlmostEqual(eval(str(expr)), eval(str(expr_red)))

test_solvers.py (https://gitlab.com/christoph-conrads/DCGeig) Python · 486 lines

9

10 import unittest

11

247

248 class Test_solve_with_qr_csd(unittest.TestCase):

249 dtypes = [NP.float32, NP.float64]

296

297 class Test_solve_with_gsvd(unittest.TestCase):

298 dtypes = [NP.float32, NP.float64]

342

343 class Test_deflate_gep(unittest.TestCase):

344 dtypes = [NP.float32, NP.float64]

440

441 class Test_solve_with_deflation(unittest.TestCase):

442 dtypes = [NP.float32, NP.float64]

test_search.py (https://github.com/fetchfans/braintree_python.git) Python · 370 lines

2

3 class TestSearch(unittest.TestCase):

4 def test_text_node_is(self):

26 self.assertTrue(TestHelper.includes(collection, trial_subscription))

27 self.assertFalse(TestHelper.includes(collection, trialless_subscription))

28

50

51 self.assertTrue(TestHelper.includes(collection, trial_subscription))

52 self.assertFalse(TestHelper.includes(collection, trialless_subscription))

75

76 self.assertTrue(TestHelper.includes(collection, trial_subscription))

77 self.assertFalse(TestHelper.includes(collection, trialless_subscription))

203

204 self.assertTrue(TestHelper.includes(collection, active_subscription))

205 self.assertFalse(TestHelper.includes(collection, canceled_subscription))

datatests.py (https://github.com/rillian/firefox.git) Python · 237 lines

1 import pymake.data, pymake.functions, pymake.util

2 import unittest

3 import re

13

14 class SplitWordsTest(unittest.TestCase):

15 testdata = (

43

44 class LRUTest(unittest.TestCase):

45 # getkey, expected, funccount, debugitems

123

124 class StringExpansionTest(unittest.TestCase):

125 def test_base_expansion_interface(self):

139

140 class ExpansionTest(unittest.TestCase):

141 def test_is_static_string(self):

test_u2ftoken.py (https://gitlab.com/sheshanarayanag/LinOTP) Python · 343 lines

31 try:

32 import unittest2 as unittest

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."

37 else:

38 import unittest

39

42

43 class U2FTokenClassTestCase(unittest.TestCase):

44

143 self.u2f_token.token.LinOtpIsactive = True

144 with self.assertRaises(ValueError):

145 self.u2f_token._verifyCounterValue(499)

test_numbers.py (https://github.com/jackygrahamez/DrugDiscovery-Home.git) Python · 230 lines

1 from ctypes import *

2 import unittest

3 import sys, struct

42

43 class 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)

100 for t in signed_types + unsigned_types:

101 self.assertRaises(TypeError, t, 3.14)

102

123 def test_int_from_address(self):

124 from array import array

125 for t in signed_types + unsigned_types:

test_decorators.py (https://github.com/thearn/OpenMDAO-Framework.git) Python · 340 lines

1

2 import unittest

3 from inspect import getmembers, ismethod

84

85 class DelegateTestCase(unittest.TestCase):

86

100 self.assertEqual(f.del_amethod(1,2,0), 6)

101 self.assertTrue(hasattr(f,'_gooddelegate'))

102

215

216 class StubIfMissingTestCase(unittest.TestCase):

217 def test_stub_class(self):

258

259 class AcceptsTestCase(unittest.TestCase):

260

BoundingBoxTree.py (https://bitbucket.org/pefarrell/dolfin.git) Python · 385 lines

22

23 import unittest

24 import numpy

30

31 class BoundingBoxTreeTest(unittest.TestCase):

32

242 if MPI.size(mesh.mpi_comm()) == 1:

243 self.assertIn(first, reference[mesh.topology().dim()])

244

257 if MPI.size(mesh.mpi_comm()) == 1:

258 self.assertIn(first, reference[dim])

259

262 if MPI.size(mesh.mpi_comm()) == 1:

263 self.assertIn(first, reference[mesh.topology().dim()])

264

db_mysql.py (https://gitlab.com/pmuontains/Odoo) Python · 165 lines

3 # Based on tests by: aarranz

4 from south.tests import unittest

5

10

11 class 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_nailgun_protocol.py (https://gitlab.com/Ivy001/pants) Python · 217 lines

4

5 from __future__ import (absolute_import, division, generators, nested_scopes, print_function,

6 unicode_literals, with_statement)

8 import socket

9 import unittest

10

15

16 class TestChunkType(unittest.TestCase):

17 def test_chunktype_constants(self):

29

30 class TestNailgunProtocol(unittest.TestCase):

31 EMPTY_PAYLOAD = ''

61 self.assertEqual(arguments, self.TEST_ARGUMENTS)

62 self.assertEqual(environment, self.TEST_ENVIRON)

63

tests.py (https://github.com/fvbock/gDBPool.git) Python · 260 lines

17

18 import unittest

19 import random

20 import logging

21

22 from gevent.select import select

23 from gevent.queue import Queue

26 from gdbpool.gdbpool_error import DBInteractionException, DBPoolConnectionException, PoolConnectionException, StreamEndException

27 from gdbpool.interaction_pool import DBInteractionPool

28 from gdbpool.connection_pool import DBConnectionPool

37

38 class gDBPoolTests( unittest.TestCase ):

39

LumiBased_t.py (https://github.com/dmwm/WMCore.git) Python · 307 lines

8

9 from builtins import next, range

10

11 import unittest

12

13 from WMCore.DataStructs.File import File

14 from WMCore.DataStructs.Fileset import Fileset

15 from WMCore.DataStructs.Job import Job

16 from WMCore.DataStructs.Subscription import Subscription

22

23 class LumiBasedTest(unittest.TestCase):

24 """

SpaceGroupTest.py (https://github.com/wdzhou/mantid.git) Python · 164 lines

1 # pylint: disable=no-init,invalid-name,too-many-public-methods

2 from __future__ import (absolute_import, division, print_function)

3

4 import unittest

5 from mantid.geometry import SpaceGroupFactory, UnitCell

7

8 class SpaceGroupTest(unittest.TestCase):

9 def test_creation(self):

29

30 self.assertTrue(sg.isAllowedUnitCell(cubic))

31 self.assertFalse(sg.isAllowedUnitCell(tetragonal))

41

42 self.assertTrue(sgRh.isAllowedUnitCell(rhombohedral))

43 self.assertFalse(sgRh.isAllowedUnitCell(hexagonal))

test_redaction.py (https://gitlab.com/JigmeDatse/synapse) Python · 211 lines

16

17 from tests import unittest

18 from twisted.internet import defer

22

23 from tests.utils import setup_test_homeserver

24

27

28 class 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

autodetection.py (https://github.com/jcrobak/hue.git) Python · 233 lines

1 import unittest

2

4

5 class TestComparison(unittest.TestCase):

6

21

22 self.assertEqual(

23 AutoChanges.different_attributes(

33

34 self.assertEqual(

35 AutoChanges.different_attributes(

109

110 self.assertEqual(

111 AutoChanges.different_attributes(

210

211 self.assertEqual(

212 AutoChanges.different_attributes(

test_fdesc.py (https://github.com/analogue/mythbox.git) Python · 235 lines

18 from twisted.python.util import untilConcludes

19 from twisted.trial import unittest

20

21

22 class ReadWriteTestCase(unittest.TestCase):

23 """

111 result = fdesc.readFromFD(self.r, l.append)

112 self.assertEquals(l, [])

113 self.assertEquals(result, None)

121 os.close(self.w)

122 self.assertEquals(self.read(), fdesc.CONNECTION_DONE)

123

178

179 class CloseOnExecTests(unittest.TestCase):

180 """

WMConfigCache_t.py (https://github.com/PerilousApricot/WMCore.git) Python · 213 lines

8 import os

9 import unittest

10 import tempfile

12

13 from WMCore.Agent.Configuration import Configuration

14 from WMCore.Cache.WMConfigCache import ConfigCache, ConfigCacheException

17

18 class testWMConfigCache(unittest.TestCase):

19 """

78

79 self.assertTrue(testFlag)

80

109

110 self.assertEqual(configString1, configString2)

111 self.assertEqual(configCache2.attachments.get('attach1', None), attach)

unit-Preprocessor.py (https://github.com/diogogmt/mozilla-central.git) Python · 494 lines

1 import unittest

2

5 import sys

6 import os.path

7 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

8

9 from Preprocessor import Preprocessor

10

15

16 class TestPreprocessor(unittest.TestCase):

17 """

111 self.pp.do_include(f)

112 self.assertEqual(self.pp.out.getvalue(), "PASS\n")

113

224 self.pp.do_include(f)

225 self.assertEqual(self.pp.out.getvalue(), """You should see two nice ascii tables

226 +-+-+-+

sdl_keyboard_test.py (https://bitbucket.org/pcraven/pygame2.git) Python · 194 lines

1 import sys

2 import unittest

3 import pygame2.sdl as sdl

4 import pygame2.sdl.rect as rect

5 import pygame2.sdl.keyboard as keyboard

6 import pygame2.sdl.scancode as scancode

7 import pygame2.sdl.keycode as keycode

8 import pygame2.sdl.video as video

9

10

11 class SDLKeyboardTest(unittest.TestCase):

12 __tags__ = ["sdl"]

test_qgsmaprenderercache.py (https://github.com/ricardogsilva/Quantum-GIS.git) Python · 318 lines

12

13 import qgis # NOQA

14

15 from qgis.core import (QgsMapRendererCache,

16 QgsRectangle,

19 QgsMapToPixel)

20 from qgis.testing import start_app, unittest

21 from qgis.PyQt.QtCore import QCoreApplication

22 from qgis.PyQt.QtGui import QImage

23 from time import sleep

26

27 class TestQgsMapRendererCache(unittest.TestCase):

28

test_test_util_validation.py (https://gitlab.com/murder187ss/buildbot) Python · 200 lines

14 # Copyright Buildbot Team Members

15 import datetime

16

17 from twisted.python import log

18 from twisted.trial import unittest

19

20 from buildbot.test.util import validation

21 from buildbot.util import UTC

23

24 class VerifyDict(unittest.TestCase):

25

29 msgs = list(validator.validate('g', g))

30 self.assertEqual(msgs, [], 'messages for %r' % (g,))

31 for b in bad:

checker_test.py (https://github.com/emperorcezar/chirpradio-machine.git) Python · 189 lines

2

3 import unittest

4 import mutagen.id3

7 from chirp.library import checker

8 from chirp.library import constants

9 from chirp.library import ufid

20

21 class CheckerTest(unittest.TestCase):

22

88 town_tag.text = [constants.TOWN_FILE_OWNER]

89 self.assertNoTagError(checker.ERROR_TOWN_INCORRECT)

90

93 self.au_file.mutagen_id3.add(tpe_tag)

94 self.assertTagError(checker.ERROR_TPE_NONSTANDARD)

95

TestDimensionListModel.py (https://bitbucket.org/cwinkelmann/plista-contest-python.git) Python · 335 lines

5 '''

6 import unittest

7 import cql

8 from random import uniform

9

10 from plistaContestPy.plistaContestBackend.config import config_global

11 from plistaContestPy.plistaContestBackend.config import config_local

12 from plistaContestPy.plistaContestBackend.real.models.DimensionListModel import DimensionListModel

13 from contest.migrations.setup_keyspaces import Setup_Keyspaces

17

18 class TestDimensionListModel(unittest.TestCase):

19 def setUp(self):

test.py (https://github.com/xuanhan863/pydub.git) Python · 219 lines

1 import unittest

2 import os

9

10 class UtilityTests(unittest.TestCase):

11

21

22 class FileAccessTests(unittest.TestCase):

23

39 test1 = test2 = test3 = None

40 class AudioSegmentTests(unittest.TestCase):

41

107

108 self.assertEqual(len(empty), 0)

109 self.assertEqual(len(second_long_slice), 1000)

180

181 self.assertTrue(0 < fade_out.rms < seg.rms)

182 self.assertTrue(0 < fade_in.rms < seg.rms)

DrillExportModelTest.py (https://github.com/mantidproject/mantid.git) Python · 176 lines

8 import unittest

9 from unittest import mock

10

13

14 class DrillExportModelTest(unittest.TestCase):

15

77 self.EXPORT_ALGORITHMS["a1"])

78 self.assertEqual(self.exportModel._exports, {})

79 self.assertEqual(self.exportModel._successExports, {})

95 self.exportModel.activateAlgorithm("ea2")

96 self.assertEqual(self.exportModel._exportAlgorithms["ea2"], True)

97 self.exportModel.activateAlgorithm("ea2")

101 def test_inactivateAlgorithm(self):

102 self.assertEqual(self.exportModel._exportAlgorithms["ea1"], True)

103 self.exportModel.inactivateAlgorithm("ea1")

test_action_manager_builder.py (https://github.com/pankajp/pyface.git) Python · 347 lines

1 # Standard library imports.

2 import unittest

3

6 MenuManager, MenuBarManager

7 from pyface.tasks.action.api import GroupSchema, MenuSchema, MenuBarSchema, \

8 SchemaAddition

13

14 class ActionManagerBuilderTestCase(unittest.TestCase):

15

34 if isinstance(first, ActionItem):

35 self.assertEquals(first.action.name, second.action.name)

36

42 elif isinstance(first, Group):

43 self.assertEquals(first.separator, second.separator)

44 children1, children2 = first.items, second.items

dryrun.py (https://github.com/albermax/innvestigate.git) Python · 338 lines

12 import keras.backend as K

13 import keras.models

14 import numpy as np

15 import unittest

16

46

47 class BaseLayerTestCase(unittest.TestCase):

48 """

162 self.assertFalse(np.any(np.isnan(analysis.ravel())))

163 self.assertFalse(True)

164

167 """Workaround for move from unit-tests to pytest."""

168 # todo: Mixing of pytest and unittest is not ideal.

169 # Move completely to pytest.

test_colorWidgets.py (https://github.com/jackygrahamez/DrugDiscovery-Home.git) Python · 303 lines

14

15 import sys,unittest,Tkinter

16 from time import sleep

23

24 class colorEditorTest(unittest.TestCase):

25

119 self.assertEqual(old_rVal!=new_rVal ,True)

120 self.assertEqual(old_gVal!=new_gVal ,True)

121 self.assertEqual(old_bVal!=new_bVal ,True)

135 new_hexVal = ce.hexVal.get()

136 self.assertEqual(old_hexVal!=new_hexVal,True)

137 ce.master.update()

270

271 class ColorChooserTest(unittest.TestCase):

272

capabilities.py (https://github.com/jcrobak/hue.git) Python · 289 lines

7 """

8 from time import time

9 import array

10 import unittest

11

12

13 class DatabaseTest(unittest.TestCase):

14

22 def setUp(self):

23 import gc

24 db = self.db_module.connect(*self.connect_args, **self.connect_kwargs)

34 if self.leak_test:

35 import gc

36 del self.cursor

test_common.py (https://github.com/datakungfu/pandas.git) Python · 296 lines

3

4 import unittest

5

6 from pandas import Series, DataFrame, date_range, DatetimeIndex

7 from pandas.core.common import notnull, isnull

8 import pandas.core.common as com

50

51 import pandas.lib as lib

52 idx = np.asarray(idx)

153

154 class TestTake(unittest.TestCase):

155

195 indexer = [2, 1, 0, -1]

196 self.assertRaises(Exception, com.take_2d, data,

197 indexer, out=out0, axis=0)

analisadorSintáticoTeste.py (https://gitlab.com/danielbbruno/SimuS) Python · 339 lines

1

2 import unittest

3 from SimuS.compilador import Símbolo, AnalisadorSintático

8

9 class AnalisadorSintáticoCasoDeTeste(unittest.TestCase):

10 def setUp(self):

206 self.assertIn((1, "DW", self.mem.tamanhoDoEndereço, 1), asin.endereçosDasAlocações)

207 self.assertEquals(self.mem.dados, self.novaMem.dados)

208

216 self.novaMem[:len(código)] = código

217 self.assertEquals(self.mem.dados, self.novaMem.dados)

218

222 asin = AnalisadorSintático(tokens, self.mem)

223 self.assertRaises(exceções.ExceçãoOperandoInválido,asin.iniciaAnálise)

224

test_package.py (https://github.com/dstuebe/coi-services.git) Python · 368 lines

12

13 from os.path import basename, dirname

14 from os import makedirs

15 from os.path import exists

16 import sys

17

18 from nose.plugins.attrib import attr

19 from mock import Mock

20 import unittest

21

43 @attr('UNIT', group='mi')

44 class IDKPackageNose(unittest.TestCase):

45 """

test_assertions.py (https://github.com/alemacgo/pypy.git) Python · 292 lines

2

3 import unittest

4

5

6 class Test_Assertions(unittest.TestCase):

7 def test_AlmostEqual(self):

26 self.assertAlmostEqual(float('inf'), float('inf'))

27 self.assertRaises(self.failureException, self.assertNotAlmostEqual,

28 float('inf'), float('inf'))

117

118 class TestableTestTrue(unittest.TestCase):

119 longMessage = True

128 def testDefault(self):

129 self.assertFalse(unittest.TestCase.longMessage)

130

PoldiCreatePeaksFromFileTest.py (https://github.com/mantidproject/mantid.git) Python · 180 lines

7 # pylint: disable=no-init,invalid-name,too-many-public-methods

8 import unittest

9 from testhelpers import assertRaisesNothing

16

17 class PoldiCreatePeaksFromFileTest(unittest.TestCase):

18 testname = None

20 def __init__(self, *args):

21 unittest.TestCase.__init__(self, *args)

22

90

91 self.assertEqual(ws.getNumberOfEntries(), 2)

92 self.assertTrue(ws.contains("SiliconCarbon"))

93 self.assertTrue(ws.contains("Silicon"))

94

test_deregister.py (https://gitlab.com/github-cloud-corp/aws-cli) Python · 193 lines

14 from argparse import Namespace

15 from mock import MagicMock, call

16 from awscli.customizations.codedeploy.deregister import Deregister

17 from awscli.testutils import unittest

18

19

20 class TestDeregister(unittest.TestCase):

21 def setUp(self):

105 self.assertIn('tags', self.args)

106 self.assertEquals(self.tags, self.args.tags)

107 self.codedeploy.remove_tags_from_on_premises_instances.\

186 self.assertFalse(self.iam.delete_user_policy.called)

187 self.assertFalse(self.list_access_keys.paginate.called)

188 self.assertFalse(self.iam.delete_access_key.called)

tests.py (https://github.com/leetrout/django-zebra.git) Python · 365 lines

1 import unittest

2 from django.conf import settings

4 from zebra.signals import *

5 from django.utils import simplejson

6

7

8 from django.core.urlresolvers import reverse

9

10 class TestWebhooks(unittest.TestCase):

11

205

206 self.assertEqual(self.signal_kwargs, None)

207

275

276 from zebra.models import Customer

277 cust = Customer.objects.create()

test_contextlib.py (https://gitlab.com/envieidoc/Clover) Python · 326 lines

4 import tempfile

5 import unittest

6 from contextlib import * # Tests __all__

13

14 class ContextManagerTestCase(unittest.TestCase):

15

108

109 class NestedTestCase(unittest.TestCase):

110

221

222 class ClosingTestCase(unittest.TestCase):

223

249

250 class FileContextTestCase(unittest.TestCase):

251

test_Admin.py (https://github.com/mobyle2-legacy/mobyle2.core.git) Python · 263 lines

8

9 import unittest2 as unittest

10 import os, sys, stat

11 import shutil

12 from time import mktime

20

21 import Mobyle.Test.MobyleTest

22 from Mobyle.MobyleError import MobyleError

23 from Mobyle.Admin import Admin

24

25

26 class AdminTest(unittest.TestCase):

27

test_enumerate.py (https://github.com/cguardia/empythoned.git) Python · 255 lines

1 import unittest

2 import sys

63

64 class EnumerateTestCase(unittest.TestCase):

65

71 e = self.enum(self.seq)

72 self.assertEqual(iter(e), e)

73 self.assertEqual(list(self.enum(self.seq)), self.res)

76 def test_getitemseqn(self):

77 self.assertEqual(list(self.enum(G(self.seq))), self.res)

78 e = self.enum(G(''))

109 # whenever nothing else holds a reference to it

110 self.assertEqual(len(set(map(id, list(enumerate(self.seq))))), len(self.seq))

111 self.assertEqual(len(set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))

128

129 class TestReversed(unittest.TestCase):

130

test_bipartite.py (https://github.com/igraph/python-igraph.git) Python · 177 lines

1 import unittest

2 from igraph import *

3

4 class BipartiteTests(unittest.TestCase):

5 def testCreateBipartite(self):

6 g = Graph.Bipartite([0, 1]*5, [(0,1),(2,3),(4,5),(6,7),(8,9)])

7 self.assertTrue(g.vcount() == 10 and g.ecount() == 5 and g.is_directed() == False)

8 self.assertTrue(g.is_bipartite())

9 self.assertTrue(g.vs["type"] == [False, True]*5)

10

12 g = Graph.Full_Bipartite(10, 5)

13 self.assertTrue(g.vcount() == 15 and g.ecount() == 50 and g.is_directed() == False)

14 expected = sorted([(i, j) for i in range(10) for j in range(10, 15)])

15 self.assertTrue(sorted(g.get_edgelist()) == expected)

16 self.assertTrue(g.vs["type"] == [False]*10 + [True]*5)

match_syscalls_unittest.py (https://github.com/thiagomanel/Beefs-trace-replayer.git) Python · 130 lines

1 import unittest

2 from match_syscalls import Matcher

3 from match_syscalls import match_order

4 from match_syscalls import *

5

6 class TestMatchSyscalls(unittest.TestCase):

7

13 #there is a single match -> [pid 7817] mkdir("/tmp/jdt-images", 0777) = 0

14 self.assertEquals(len(results), 1)

15 (expected_syscall, called_syscall, ok_call, ok_args, ok_rvalue) = results[0]

55 (input_call, replayed_call, match, message) = matches[0]

56 self.assertEquals(input_call, r_input[0].original_line)

57 self.assertEquals(replayed_call, str(r_output[0]))

58 self.assertEquals(match, True)

59 self.assertEquals(message, str(0))

60

test_comparator.py (https://gitlab.com/github-cloud-corp/aws-cli) Python · 235 lines

13 import datetime

14 import unittest

15

18 from awscli.customizations.s3.comparator import Comparator

19 from awscli.customizations.s3.filegenerator import FileStat

20

21

22 class 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

project_spec.py (http://mobilegtd.googlecode.com/svn/trunk/) Python · 327 lines

1 import unittest

2 from mock import Mock

3 import model.project

4

5 from model.project import Project

6 from model import project

7 from model import action

8

9

10 class ProjectClassBehaviour(unittest.TestCase):

11 def setUp(self):

19

20 class ProjectBehaviour(unittest.TestCase):

21

test_shared.py (https://github.com/ynd/Theano.git) Python · 311 lines

1 import numpy

2 import unittest

3

5 from theano.tensor import Tensor, TensorType

6 from theano.compile.sharedvalue import *

7

8

9 class Test_SharedVariable(unittest.TestCase):

10

153 assert b.type == theano.tensor.dscalar

154 self.assertRaises(TypeError, f, b, 8)

155

197 b = shared(numpy.zeros((5, 5), dtype='float32'))

198 self.assertRaises(TypeError, f, b, numpy.random.rand(5, 5))

199

test_image_helpers.py (https://github.com/enthought/pyface.git) Python · 202 lines

9

10 import unittest

11

12 import wx

13

14 from traits.testing.optional_dependencies import numpy as np, requires_numpy

15 from ..image_helpers import (

20

21 class TestImageHelpers(unittest.TestCase):

22

134 @requires_numpy

135 class TestArrayImageHelpers(unittest.TestCase):

136

test_util.py (https://bitbucket.org/lsun/pyramid.git) Python · 257 lines

1 import unittest

2 from pyramid.compat import PY3

3

4 class Test_InstancePropertyMixin(unittest.TestCase):

5 def _makeOne(self):

11 def _targetClass(self):

12 from pyramid.util import InstancePropertyMixin

13 return InstancePropertyMixin

20 foo.bar = 1

21 self.assertEqual(1, foo.worker)

22 foo.bar = 2

111

112 class Test_WeakOrderedSet(unittest.TestCase):

113 def _makeOne(self):

182

183 class Test_object_description(unittest.TestCase):

184 def _callFUT(self, object):