# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import sys
import types
import warnings
import pytest
from cryptography.utils import deprecated
class TestDeprecated(object):
def test_deprecated(self, monkeypatch):
mod = types.ModuleType("TestDeprecated/test_deprecated")
monkeypatch.setitem(sys.modules, mod.__name__, mod)
mod.X = deprecated(
value=1,
module_name=mod.__name__,
message="deprecated message text",
warning_class=DeprecationWarning
)
mod.Y = deprecated(
value=2,
module_name=mod.__name__,
message="more deprecated text",
warning_class=PendingDeprecationWarning,
)
mod = sys.modules[mod.__name__]
mod.Z = 3
with warnings.catch_warnings(record=True) as log:
warnings.simplefilter("always", PendingDeprecationWarning)
warnings.simplefilter("always", DeprecationWarning)
assert mod.X == 1
assert mod.Y == 2
assert mod.Z == 3
[msg1, msg2] = log
assert msg1.category is DeprecationWarning
assert msg1.message.args == ("deprecated message text",)
assert msg2.category is PendingDeprecationWarning
assert msg2.message.args == ("more deprecated text",)
assert "Y" in dir(mod)
def test_deleting_deprecated_members(self, monkeypatch):
mod = types.ModuleType("TestDeprecated/test_deprecated")
monkeypatch.setitem(sys.modules, mod.__name__, mod)
mod.X = deprecated(
value=1,
module_name=mod.__name__,
message="deprecated message text",
warning_class=DeprecationWarning
)
mod.Y = deprecated(
value=2,
module_name=mod.__name__,
message="more deprecated text",
warning_class=PendingDeprecationWarning,
)
mod = sys.modules[mod.__name__]
mod.Z = 3
with warnings.catch_warnings(record=True) as log:
warnings.simplefilter("always", PendingDeprecationWarning)
warnings.simplefilter("always", DeprecationWarning)
del mod.X
del mod.Y
del mod.Z
[msg1, msg2] = log
assert msg1.category is DeprecationWarning
assert msg1.message.args == ("deprecated message text",)
assert msg2.category is PendingDeprecationWarning
assert msg2.message.args == ("more deprecated text",)
assert "X" not in dir(mod)
assert "Y" not in dir(mod)
assert "Z" not in dir(mod)
with pytest.raises(AttributeError):
del mod.X
tree/lib/lufa?id=c0baf2a964b10d708281c704c0b049a1cf0f4914'>lufa/Projects/TempDataLogger/Lib/FATFs/integer.h
blob: 5408fe6b3e0ad820d162264d54c43c48df9e1e91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/*-------------------------------------------*/
/* Integer type definitions for FatFs module */
/*-------------------------------------------*/
#ifndef _INTEGER
#define _INTEGER
#ifdef _WIN32 /* FatFs development platform */
#include <windows.h>
#include <tchar.h>
#else /* Embedded platform */
/* These types must be 16-bit, 32-bit or larger integer */
typedef int INT;
typedef unsigned int UINT;
/* These types must be 8-bit integer */
typedef char CHAR;
typedef unsigned char UCHAR;
typedef unsigned char BYTE;
/* These types must be 16-bit integer */
typedef short SHORT;
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef unsigned short WCHAR;
/* These types must be 32-bit integer */
typedef long LONG;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
#endif
#endif
|