def test_default_values(): a = Strings() assert '' == a.empty_string assert 'Hello world!' == a.def_string a.def_string = 'Bye world' assert 'Bye world' == a.def_string assert 'Hello world!' == Strings.DEF_STRING__DEFAULT assert 'Hello world!' == a.DEF_STRING__DEFAULT assert 'Hello\'world!' == a.DEF_STRING2__DEFAULT assert 'Hello"world!' == a.DEF_STRING3__DEFAULT assert 'Hello\'world!' == a.DEF_STRING4__DEFAULT assert 'Hello"world!' == a.DEF_STRING5__DEFAULT with pytest.raises(AttributeError): setattr(Strings, 'DEF_STRING__DEFAULT', 'bar') b = StringArrays() assert ['What', 'a', 'wonderful', 'world', '!'] == b.DEF_STRING_DYNAMIC_ARRAY_VALUE__DEFAULT assert ['Hello', 'World', '!'] == b.DEF_STRING_STATIC_ARRAY_VALUE__DEFAULT assert ['Hello', 'World', '!'] == b.DEF_STRING_BOUNDED_ARRAY_VALUE__DEFAULT assert ['H"el\'lo', 'Wo\'r"ld'] == b.DEF_VARIOUS_QUOTES__DEFAULT assert ['Hel,lo', ',World', 'abcd', '!,'] == b.DEF_VARIOUS_COMMAS__DEFAULT c = Various() assert [5, 23] == c.TWO_UINT16_VALUE__DEFAULT assert [5, 23] == c.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT assert '\x01' == c.CHAR_VALUE__DEFAULT assert '1' != c.CHAR_VALUE__DEFAULT assert b'\x01' == c.BYTE_VALUE__DEFAULT assert b'1' != c.BYTE_VALUE__DEFAULT
def test_default_values(): a = Strings() assert '' == a.empty_string assert 'Hello world!' == a.def_string a.def_string = 'Bye world' assert 'Bye world' == a.def_string assert 'Hello world!' == Strings.DEF_STRING__DEFAULT assert 'Hello world!' == a.DEF_STRING__DEFAULT assert "Hello'world!" == a.DEF_STRING2__DEFAULT assert 'Hello"world!' == a.DEF_STRING3__DEFAULT assert "Hello'world!" == a.DEF_STRING4__DEFAULT assert 'Hello"world!' == a.DEF_STRING5__DEFAULT with pytest.raises(AttributeError): setattr(Strings, 'DEF_STRING__DEFAULT', 'bar') a = WStrings() assert '' == a.empty_wstring assert 'Hello world!' == a.def_wstring a.def_wstring = 'Bye world' assert 'Bye world' == a.def_wstring assert 'Hello world!' == WStrings.DEF_WSTRING__DEFAULT assert 'Hello world!' == a.DEF_WSTRING__DEFAULT assert "Hello'world!" == a.DEF_WSTRING2__DEFAULT assert 'Hello"world!' == a.DEF_WSTRING3__DEFAULT assert "Hello'world!" == a.DEF_WSTRING4__DEFAULT assert 'Hello"world!' == a.DEF_WSTRING5__DEFAULT with pytest.raises(AttributeError): setattr(WStrings, 'DEF_WSTRING__DEFAULT', 'bar') b = StringArrays() assert ['What', 'a', 'wonderful', 'world', '!'] == b.DEF_STRING_DYNAMIC_ARRAY_VALUE__DEFAULT assert ['Hello', 'World', '!'] == b.DEF_STRING_STATIC_ARRAY_VALUE__DEFAULT assert ['Hello', 'World', '!'] == b.DEF_STRING_BOUNDED_ARRAY_VALUE__DEFAULT assert ['H"el\'lo', 'Wo\'r"ld'] == b.DEF_VARIOUS_QUOTES__DEFAULT assert ['Hel,lo', ',World', 'abcd', '!,'] == b.DEF_VARIOUS_COMMAS__DEFAULT c = Various() assert isinstance(c.TWO_UINT16_VALUE__DEFAULT, numpy.ndarray) assert (2, ) == c.TWO_UINT16_VALUE__DEFAULT.shape assert numpy.uint16 == c.TWO_UINT16_VALUE__DEFAULT.dtype assert [5, 23] == c.TWO_UINT16_VALUE__DEFAULT.tolist() assert isinstance(c.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT, array.array) assert 'i' == \ c.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT.typecode assert [5, 23] == \ c.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT.tolist() assert 1 == c.CHAR_VALUE__DEFAULT assert '1' != c.CHAR_VALUE__DEFAULT assert b'\x01' == c.BYTE_VALUE__DEFAULT assert b'1' != c.BYTE_VALUE__DEFAULT
def test_default_values(): a = Strings() assert(a.empty_string is None) assert(a.def_string == 'Hello world!') a.def_string = 'Bye world' assert(a.def_string == 'Bye world') assert(Strings.DEF_STRING__DEFAULT == 'Hello world!') assert(a.DEF_STRING__DEFAULT == 'Hello world!') assert_raises(AttributeError, setattr, Strings, 'DEF_STRING__DEFAULT', 'bar') assert(Various.TWO_UINT16_VALUE__DEFAULT == (5, 23))
def test_default_values(): a = Strings() assert a.empty_string is '' assert 'Hello world!' == a.def_string a.def_string = 'Bye world' assert 'Bye world' == a.def_string assert 'Hello world!' == Strings.DEF_STRING__DEFAULT assert 'Hello world!' == a.DEF_STRING__DEFAULT assert_raises(AttributeError, setattr, Strings, 'DEF_STRING__DEFAULT', 'bar') b = Various() assert [5, 23] == b.TWO_UINT16_VALUE__DEFAULT assert [5, 23] == b.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT assert '\x01' == b.CHAR_VALUE__DEFAULT assert '1' != b.CHAR_VALUE__DEFAULT assert b'\x01' == b.BYTE_VALUE__DEFAULT assert b'1' != b.BYTE_VALUE__DEFAULT
def test_default_values(): a = Strings() assert a.empty_string is '' assert 'Hello world!' == a.def_string a.def_string = 'Bye world' assert 'Bye world' == a.def_string assert 'Hello world!' == Strings.DEF_STRING__DEFAULT assert 'Hello world!' == a.DEF_STRING__DEFAULT assert 'Hello"world!' == a.DEF_STRING_DELIMITER__DEFAULT assert "Hello'world!" == a.DEF_STRING_DELIMITER2__DEFAULT assert_raises(AttributeError, setattr, Strings, 'DEF_STRING__DEFAULT', 'bar') b = Various() assert [5, 23] == b.TWO_UINT16_VALUE__DEFAULT assert [5, 23] == b.UP_TO_THREE_INT32_VALUES_WITH_DEFAULT_VALUES__DEFAULT assert '\x01' == b.CHAR_VALUE__DEFAULT assert '1' != b.CHAR_VALUE__DEFAULT assert b'\x01' == b.BYTE_VALUE__DEFAULT assert b'1' != b.BYTE_VALUE__DEFAULT