text stringlengths 12 6.59M |
|---|
#! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
# import sys
import os.path
path_to_script = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.join(path_to_script, "../py/computation/"))
# sys.path.append(os.path.join(path_to_script, "../"))
import unittest
import nump... |
import superdesk
from superdesk.tests import TestCase
from .services import UsersService
class PrivilegesTestCase(TestCase):
def test_admin_has_all_privileges(self):
with self.app.app_context():
service = UsersService('users', backend=superdesk.get_backend())
user = {'user_type':... |
# Python implementation of the MySQL client-server protocol
# http://dev.mysql.com/doc/internals/en/client-server-protocol.html
# Error codes:
# http://dev.mysql.com/doc/refman/5.5/en/error-messages-client.html
from __future__ import print_function
from ._compat import PY2, range_type, text_type, str_type, JYTHON, IRON... |
#Depends on web.py, psycopg2, PyYaml, pytz, python-dateutil
import web, psycopg2
import json, yaml, xmlrpclib
import datetime, pytz
import skysql
from dateutil.parser import parse as datetimeparse
from dblogin import dbname, dbuser, dbpass
categories = {}
#The temptation to name this cat_herder was extraordinary
def c... |
#!/usr/bin/env python
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice... |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
import tkinter as tk
import pytest
from tk_tools import LabelGrid
from tests.test_basic import root
def test_with_header(root):
lg = LabelGrid(root, 3, headers=['a', 'b', 'c'])
assert True
def test_header_len_doesnt_match_cols(root):
with pytest.raises(ValueError):
LabelGrid(root, 2, headers... |
# pyOCD debugger
# Copyright (c) 2015-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
import logging
import tornado.web as web
logger = logging.getLogger(__name__)
class MessageHandler(web.RequestHandler):
def post(self):
logger.info('Got message %s', self.request.body)
self.finish('got it')
|
# -*- coding: utf-8 -*-
import unittest
import pathlib2 as pathlib
from refmanage import BibFile
from pybtex.database import BibliographyData
from pybtex.exceptions import PybtexError
# Base classes
# ============
class Base(unittest.TestCase):
"""
Base class for tests
This class is intended to be subcla... |
"""Module for easy compartmental implementation of a `BRIAN network`_.
Build parts of a network via subclassing :class:`~pypet.brian.network.NetworkComponent` and
:class:`~pypet.brian.network.NetworkAnalyser` for recording and statistical analysis.
Specify a :class:`~pypet.brian.network.NetworkRunner` (subclassing op... |
# coding=utf-8
import json
import requests
import unittest
from loadimpact.clients import ApiTokenClient, Client
from loadimpact.exceptions import (
ApiError, ConnectionError, HTTPError, TimeoutError)
from loadimpact.resources import (
DataStore, Test, TestConfig, UserScenario, UserScenarioValidation)
from St... |
#
# Copyright 2018 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
"""
This module provides functionality for data set analysis.
Functions include volcano plots, sorted tables, and plotting sequence levels.
"""
from __future__ import division
# Built-ins
import itertools
import logging
import os
import re
# IPython
# from IPython.display import display
# Core data analysis librar... |
#!/usr/bin/env python3
#
# Copyright (C) 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
__author__ = 'Callum McLean <calmcl1@aol.com>'
__version__= '0.1.0'
import os, os.path
import json
import subprocess
import tempfile
import argparse
import botocore.utils
import datetime, time
import backupmongo
import logging
# TODO: Move old archive detection into own method, and add unique path detection,
# ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import partial
import os
from os.path import join
import shutil
from lib2to3.main import main
FIXTURE_PATH = u'./tests/fixtures/'
def setup():
pass
def teardown():
# This finds all of the backup files that we created and replaces
# the *_in... |
"""
The DFT grids are a little different in pyquante2 from pyquante1. Here we are
only storing the points and the weights, and we will use other data objects to
store, say, the density, the basis functions, or the various gradients at each
point.
"""
import numpy as np
from pyquante2.grid.atomic_grid import atomic_grid... |
# BridgeDB by Nick Mathewson.
# Copyright (c) 2007, The Tor Project, Inc.
# See LICENSE for licensing information
"""
This module has low-level functionality for parsing bridges and arranging
them in rings.
"""
import binascii
import bisect
import hmac
import logging
import re
import sha
import socket
import time
HE... |
from __future__ import unicode_literals
try:
import io
StringIO = io.StringIO
except ImportError:
import StringIO
StringIO = StringIO.StringIO
import os
import shutil
import sys
import tempfile
import unittest
import mock
import cudnnenv
if 'linux' in sys.platform:
_available_versions = ''' v2... |
import json
import os
import re
import unittest
import billboard
VALID_CHANGE_REGEX = r'^(\+\d{1,2}|\-\d{1,2}|0|Hot Shot Debut|New|Re-Entry)$'
class CurrentHot100Test(unittest.TestCase):
"""Checks that the ChartData object for the current Hot 100 chart
has all valid fields, and that its entries also have va... |
from __future__ import print_function
import pyrat
import numpy as np
import logging
from PyQt4 import QtGui, QtCore
from .Dialogs import PaletteSelector, LayerWidget
from .StatusBar import *
from . import egg
from pyrat.tools import ProgressBar
from pyrat.viewer.tools import sarscale, colortables, subsample
class M... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from jnius import autoclass
class StringArgumentForByteArrayTest(unittest.TestCase):
def test_string_arg_for_byte_array(self):
# the ByteBuffer.wrap() accept only byte[].
By... |
# Created By: Virgil Dupras
# Created On: 2008-04-20
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses... |
'''
Collection of constants for elements in ROI_PAC headers (*.rsc)
Created on 14/09/2012
@author: Ben Davies
'''
# lookup keys for the fields in PyRate's custom GeoTIFF files
PYRATE_NCOLS = 'NCOLS'
PYRATE_NROWS = 'NROWS'
PYRATE_X_STEP = 'X_STEP'
PYRATE_Y_STEP = 'Y_STEP'
PYRATE_LAT = 'LAT'
PYRATE_LONG = 'LONG'
PYRATE_... |
# -*- coding: utf-8 -*-
"""Unit tests for cartoframes.context"""
import unittest
import os
import sys
import json
import warnings
from carto.exceptions import CartoException
from cartoframes.context import CartoContext
from cartoframes import Dataset
from cartoframes.columns import normalize_name
from utils import ... |
from __future__ import absolute_import, division
import datetime
import sys
from collections import OrderedDict
import numpy as np
import theano
from theano import tensor
from . import nptools, tasktools, theanotools, utils
from .debug import DEBUG
from .networks import Networks
from .sgd import... |
# Created By: Virgil Dupras
# Created On: 2008-04-20
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from bs4 import BeautifulSoup
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http import QueryDict
from cms.api import add_plugin
from cms.toolbar.toolbar import CMSToolbar
from cms.uti... |
# -*- coding: utf-8 -*-
"""Unit tests for cartoframes.context"""
import unittest
import os
import sys
import json
import warnings
from carto.exceptions import CartoException
from cartoframes.context import CartoContext
from cartoframes import Dataset
from cartoframes.columns import normalize_name
from cartoframes.ge... |
import sysadmintoolkit
import dummyplugin
import logging
import unittest
import sys
import os
import pexpect
class CmdPromptTestCase(unittest.TestCase):
'''Testing commandprompt module
'''
def setUp(self):
self.original_stdout = sys.stdout
self.devnull = open(os.devnull, 'w')
self... |
import pytac.element
import pytac.device
import pytac.model
from pytac.units import PolyUnitConv
import pytest
import mock
import pytac
from constants import PREFIX, RB_PV, SP_PV
DUMMY_VALUE_1 = 40.0
DUMMY_VALUE_2 = 4.7
DUMMY_VALUE_3 = -6
mock_uc = PolyUnitConv([2, 0])
@pytest.fixture
def test_element(uc=mock_uc):... |
"""Config the user constants."""
import os
MUSCLE = os.path.expanduser("~/bin/muscle")
BLAST_PATH = "/usr/bin/"
BLASTP = os.path.join(BLAST_PATH, "blastp")
BLAST_DB_MAKER = os.path.join(BLAST_PATH, "makeblastdb")
SUFFIX = "NORM"
SEP = ";"
BASE_PATH = os.path.join(os.getcwd())
# This is where the genomes are relative... |
# -*- coding: utf-8 -*-
import astropy.units as u
import numpy as np
import h5py
def convert_w_3D(w, w_):
"""
This function converts a 4D w array to a field dictionary.
It is hardcoded to expect the following varibles:
varnames: ['h', 'm1', 'm2', 'm3', 'e', 'b1', 'b2', 'b3', 'eb', 'rhob', 'b... |
# Copyright 2015 Infoblox Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
#!/usr/bin/env python
# Full license can be found in License.md
# Full author list can be found in .zenodo.json file
# DOI:10.5281/zenodo.1199703
# ----------------------------------------------------------------------------
"""Utilities to perform common evaluations."""
import numpy as np
import os
from pysat.utils.f... |
"""Tests of http client with custom Connector"""
import asyncio
import http.cookies
import gc
import time
import socket
import unittest
import ssl
from unittest import mock
import aiohttp
from aiohttp import client
from aiohttp import test_utils
from aiohttp.client import ClientResponse, ClientRequest
from aiohttp.co... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
import os
import pytest
from pyethereum import tester, utils
import serpent
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
logger = logging.getLogger()
# customize VM log output to your needs
# hint: use 'py.test' with the '-s' option to dump logs to the console
pblogger = tester.pb.pblo... |
# -*- coding: utf-8 -*-
import re
import logging
import os.path
from datetime import datetime
from sqlalchemy.sql.expression import func
from pyramid import httpexceptions as exc
from pyramid.settings import asbool
from pyramid.security import authenticated_userid
from pyshop.models import User, Package, Classifier,... |
import os
import time
import subprocess
import signal
import libqtile
import libqtile.layout
import libqtile.bar
import libqtile.command
import libqtile.widget
import libqtile.manager
import libqtile.config
import libqtile.hook
import libqtile.confreader
import nose
from nose.tools import assert_raises
from nose.plugi... |
import pytest
import os
from flexmock import flexmock
from pyp2rpm.convertor import Convertor
from pyp2rpm.exceptions import NoSuchPackageException
from pyp2rpm.metadata_extractors import (SetupPyMetadataExtractor,
WheelMetadataExtractor)
from pyp2rpm.package_getters import Py... |
"""
Class interface for SHTOOLS.
pyshtools defines several classes that facilitate the interactive
examination of geographical gridded data and their associated
spherical harmonic coefficients. Subclasses are used to handle different
internal data types and superclasses are used to implement interface
functions and do... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015]
# daemon21.... |
#!/usr/bin/env python
# encoding: utf-8
"""Test Azkaban project module."""
from azkaban.project import *
from azkaban.job import Job, PigJob
from azkaban.util import AzkabanError, flatten, temppath
from ConfigParser import RawConfigParser
from nose.tools import eq_, ok_, raises, nottest
from nose.plugins.skip import ... |
#!/usr/bin/env python
# CREATED: 2013-10-06 22:31:29 by Dawen Liang <dl2771@columbia.edu>
# unit tests for librosa.decompose
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except:
pass
import numpy as np
import librosa
import sklearn.decomposition
def test_default_decompose():
X... |
import urllib2
import eyed3
import mechanize
import os
from bs4 import BeautifulSoup as bs
import unicodedata as ud
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class Song:
def __init__(self, keyword, filename, albumart, aaformat):
self.info = keyword.split('@')
self.filename = filename.encode('utf-8')
... |
# -*- coding: utf-8 -*-
class Etiqueta(object):
def __init__(self, etiqueta_sem_dig_verif):
if len(etiqueta_sem_dig_verif) != 13:
print '[AVISO] Etiqueta com tamanho incorreto.',
self._valor = etiqueta_sem_dig_verif
self._digito_verificador = False
self._numero = eti... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015,2016]
# daem... |
import logging
import unittest
from .helpers import run_module
logging.basicConfig(level=logging.DEBUG)
class TorchTests(unittest.TestCase):
def setUp(self):
self.name = "benchmarker"
self.imgnet_args = [
"--framework=pytorch",
"--problem_size=4",
"--batch_siz... |
from devito import SubsampledDimension, Grid, TimeFunction, Eq, Operator
from devito.tools import pprint
def test_subsampled_dimension():
nt = 10
grid = Grid(shape=(11, 11))
x, y = grid.dimensions
time = grid.time_dim
t = grid.stepping_dim
time_subsampled = SubsampledDimension('t_sub', parent=... |
import itertools
from collections import Mapping, Sequence
from copy import deepcopy
from .utils import get_shortish_repr, ensure_tuple
class BaseVariable(object):
def __init__(self, source, exclude=()):
self.source = source
self.exclude = ensure_tuple(exclude)
self.code = compile(source,... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015,2016]
# daem... |
import random
import time
import nose.tools as nt
from dogstatsd import MetricsAggregator
class TestUnitDogStatsd(object):
@staticmethod
def sort_metrics(metrics):
def sort_by(m):
return (m['metric'], ','.join(m['tags'] or []))
return sorted(metrics, key=sort_by)
def test... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015]
# daemon99.... |
import random
import time
import nose.tools as nt
from dogstatsd import MetricsAggregator
class TestUnitDogStatsd(object):
@staticmethod
def sort_metrics(metrics):
def sort_by(m):
return (m['metric'], ','.join(m['tags'] or []))
return sorted(metrics, key=sort_by)
def test... |
# This file is Copyright (c) 2017-2019 Florent Kermarrec <florent@enjoy-digital.fr>
# This file is Copyright (c) 2019 Tim 'mithro' Ansell <me@mith.ro>
# License: BSD
import subprocess
import unittest
import os
from migen import *
from litex.soc.integration.builder import *
RUNNING_ON_TRAVIS = (os.getenv('TRAVIS', ... |
"""Tests that our test infrastructure is really working!"""
import os, sys
sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
from coveragetest import CoverageTest
from coverage.backward import set # pylint: disable-msg=W0622
class TestingTest(CoverageTest):
"""Test... |
#!/usr/bin/python
import sys
import os
import time
import picamera
import datetime
from threading import Semaphore
import RPi.GPIO as GPIO
import daemon
import signal
spy = None
class Spy(object):
def __init__(self, folder, led_id, pir_id):
self.folder = folder
self.led = led_id
self.pi... |
# Copyright (c) 2015-2019 Vector 35 Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, ... |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... |
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import mock
import unittest
import django
from django.test import TestCase, override_settings
from django.utils import six
from django.utils.timezone import now
from django.utils import timezone
from django_filters.filters... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
__sets = {}
im... |
from __future__ import print_function # Python 2 and 3 print compatibility
import warnings
from decorator import decorator
from hail.expr import Type, TGenotype, TString, TVariant
from hail.typecheck import *
from hail.java import *
from hail.keytable import KeyTable
from hail.representation import Interval, Pedigr... |
# file testsettings.py
#
# Copyright 2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
import pytest
import sci_parameter_utils.fragment as frag
@pytest.mark.parametrize("tstr,name,args,error", [
('invalid', 'test', {}, "Unknown type 'invalid'"),
('int', 'test', {'bad_arg': 1}, "Error constructing element "
"'test' of type 'int': __init__() got an unexpected keyword "
"argument 'bad_a... |
#!/usr/bin/env python
import os
from random import randint, choice, uniform
def random_hex():
""" returns a random hex, with a random length between 2 and 64
using os.urandom"""
seedList = []
seedList_len = randint(1, 128)
count = 0
while count < seedList_len:
seedList.append(os.urando... |
"""Test functions etc, for Byterun."""
from __future__ import print_function
from . import vmtest
class TestFunctions(vmtest.VmTestCase):
def test_functions(self):
self.assert_ok("""\
def fn(a, b=17, c="Hello", d=[]):
d.append(99)
print(a, b, c, d)
... |
# Copyright 2008-2009 ITA Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
import mock
from unittest2 import TestCase
from snippets.generator import Generator
from snippets.repository import Repository
from snippets.snippet import Snippet
class GeteratorTests(TestCase):
def setUp(self):
self.repository = Repository()
self.generator = Generator(self.repository, 'theme')... |
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" Handling qidoc config files
"""
from xml.etree import ElementTree as etree
class Depends:
def __init__(self):
self.name = None
d... |
#!/usr/bin/env python
#
# Copyright (C) 2012 Ronan Keegan
#
# This code is distributed under the terms and conditions of the
# CCP4 Program Suite Licence Agreement as a CCP4 Application.
# A copy of the CCP4 licence can be obtained by writing to the
# CCP4 Secretary, Daresbury Laboratory, Warringto... |
# Copyright 2021 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any lat... |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2020 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Class for reading and writing Mir files."""
import numpy as np
from .uvdata import UVData
from . import mir_parser
from .. import utils as uvutils
from .. import get_telescope
__all_... |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
# $Id$
#
# a simple self-test
#
try:
# need Python 2.2 or better for garbage collection
from gc import get_objects
import gc
del get_objects
gc.enable()
except ImportError:
gc = None
import copy, os, sys
from StringIO import Stri... |
import os
def FindSchemeFilesOfTypeInPath(type_string, directory_path):
schemes = list()
for file_name in os.listdir(directory_path):
file_path = os.path.join(directory_path, file_name)
if not file_name.startswith('.') and file_path.endswith('.xcscheme') and os.path.isfile(file_path):
... |
import datetime
import random
import sys
import pprint
import nose
from traces import TimeSeries
def test_iterintervals():
ts = TimeSeries()
ts.set(datetime.datetime(2015, 3, 1), 1)
ts.set(datetime.datetime(2015, 3, 2), 0)
ts.set(datetime.datetime(2015, 3, 3), 1)
ts.set(datetime.datetime(2015, ... |
#
# (C) Copyright 2003 Jacek Konieczny <jajcus@bnet.pl>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
#... |
# -*- coding: utf-8 -*-
import os
import re
import unittest
import codecs
import base64
from darkslide import macro
from darkslide.generator import Generator
from darkslide.parser import Parser
DATA_DIR = os.path.join(os.path.dirname(__file__), 'test-data')
if not os.path.exists(DATA_DIR):
raise IOError('Test d... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from nose_parameterized import parameterized, param
from dateparser.languages import default_language_loader, Language
from dateparser.languages.detection import AutoDetectLanguage, ExactLanguages
from dateparser.conf import settings
from dateparser.util... |
#!/usr/bin/env python
""" Utilities for parsing command line options and arguments
This code was derived from PyCogent (www.pycogent.org) and QIIME
(www.qiime.org), where it was initally developed. It has been ported
to qcli to support accessing this functionality without those
dependencies.
"""
from copy import c... |
# -*- coding: utf-8 -*-
"""\
Here are a collection of examples of how this module can be used.
See the README or the natsort homepage for more details.
"""
from operator import itemgetter
import pytest
from natsort import as_utf8, natsorted, ns
from pytest import raises
@pytest.fixture
def float_list():
return ... |
import unittest
from app import create_app, db
from app.utils import parse_to_db
class ParseCsvTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
def tearDown(self):
... |
# coding=utf-8
# Copyright 2022 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
############################TESTS ON POTENTIALS################################
from __future__ import print_function, division
import os
import sys
import pytest
import numpy
try:
import pynbody
_PYNBODY_LOADED= True
except ImportError:
_PYNBODY_LOADED= False
from galpy import potential
from galpy.util imp... |
############################TESTS ON POTENTIALS################################
from __future__ import print_function, division
import os
import sys
import pytest
import numpy
from galpy.util.bovy_conversion import velocity_in_kpcGyr
try:
import pynbody
_PYNBODY_LOADED= True
except ImportError:
_PYNBODY_LOA... |
import unittest
from mock import mock_open, patch
from rest_framework.generics import ListAPIView
from rest_framework_ccbv.renderers import (
BasePageRenderer, IndexPageRenderer, LandPageRenderer, ErrorPageRenderer,
SitemapRenderer, DetailPageRenderer,
)
from rest_framework_ccbv.config import VERSION
from res... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_resolvers
----------------------------------
Tests for `resolvers` module.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
import logging
from wikipediabase import resolvers
from wikipediabase import fetcher
from wikipediabase... |
# -*- coding: utf-8 -*-
import unittest
import os
import re
import mock
from context import nikola
from lxml.etree import ElementTree
from lxml import etree
class RSSFeedTest(unittest.TestCase):
def setUp(self):
self.feed_filename = 'testfeed.rss'
self.blog_url = "http://some.blog"
def... |
import asyncio
from aiopg import sa
from aiopg.connection import TIMEOUT
import unittest
from sqlalchemy import MetaData, Table, Column, Integer, String
meta = MetaData()
tbl = Table('sa_tbl3', meta,
Column('id', Integer, nullable=False,
primary_key=True),
Column('name', St... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Check if pickle can serialize CoTeDe's dataset.
This is critical to allow running CoTeDe with multiprocessing.
"""
import pickle
import numpy as np
from cotede.qc import ProfileQC
from data import DummyData
def test_serialize_ProfileQC():
""" Serializ... |
"""
Main unit testing for SQLObject.
Use -vv to see SQL queries, -vvv to also see output from queries,
and together with --inserts to see the SQL from the standard
insert statements (which are often boring).
"""
from __future__ import generators
import sys, os
if '--coverage' in sys.argv:
import coverage
pri... |
"""
Main unit testing for SQLObject.
Use -vv to see SQL queries, -vvv to also see output from queries,
and together with --inserts to see the SQL from the standard
insert statements (which are often boring).
"""
from __future__ import generators
import sys, os
if '--coverage' in sys.argv:
import coverage
pri... |
import unittest
import os
import mock
from trigger.utils.templates import *
from trigger.conf import settings
from contextlib import contextmanager
from StringIO import StringIO
import cStringIO
try:
import textfsm
except ImportError:
print("""
Woops, looks like you're missing the textfsm library.
Tr... |
#!/usr/bin/env python3
# Copyright (C) 2017-2020 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... |
"""
Skymap draws the axes, radio source positions, current and target position crosshairs.
Author: Ronnie Frith
Contact: frith.ronnie@gmail.com
"""
import random,math,time
from PyQt4 import QtGui, QtCore
from srt import CoordinateSystem,Status,Mode
from radiosource import RadioSource, GalacticPlane
from astropy.time ... |
#!/usr/bin/python2.4
#
# Copyright (c) 2005-2007 rPath, Inc.
#
# All Rights Reserved
#
import base64
import testsuite
import unittest
testsuite.setup()
import copy
import os
import time
from mint import config
from mint import shimclient
from mint.web import setup, hooks
from mint.web.webhandler import HttpForbidde... |
from argparse import (
ArgumentParser,
Namespace,
)
from contextlib import contextmanager
import json
import logging
import os
from StringIO import StringIO
import subprocess
from unittest import TestCase
from mock import (
call,
patch,
)
import yaml
from deploy_stack import (
add_juju_args,
a... |
'd'
from types import StringType, NoneType
def func(a, b, *args, **kw):
'verify no warnings for variables (arguments) used before set'
print a, b, args, kw
class E(Exception):
'doc'
def x():
'instantiate a new E with many args, should not be a warning'
print E('test', 'test', 'test', 'test', 't... |
import httplib2
import logging
import os
import mox
import nose
def update_wrapper(wrapper, original):
for field in ('__module__', '__name__', '__doc__'):
setattr(wrapper, field, getattr(original, field))
def skip(fn):
def testNothing(self):
raise nose.SkipTest('skip this test')
update_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.