예제 #1
0
    def test_normal(self, value, type_hint, is_strict, expected_data, expected_str):
        dp = DataProperty(
            value, type_hint=type_hint, strict_level_map=get_strict_level_map(is_strict)
        )

        assert dp.data == expected_data
        assert dp.to_str() == expected_str
예제 #2
0
    def test_normal(self, value, type_hint, is_strict, expected_data,
                    expected_str):
        dp = DataProperty(value,
                          type_hint=type_hint,
                          strict_level_map=get_strict_level_map(is_strict))

        assert dp.data == expected_data
        assert dp.to_str() == expected_str
예제 #3
0
def serialize_dp(dp: DataProperty) -> Any:
    if dp.typecode in (Typecode.REAL_NUMBER, Typecode.INFINITY, Typecode.NAN) and isinstance(
        dp.data, Decimal
    ):
        return float(dp.data)

    if dp.typecode == Typecode.DATETIME:
        return dp.to_str()

    return dp.data
예제 #4
0
    def test_normal_format_str(self, value, format_flags, expected):
        dp = DataProperty(value, format_flags=format_flags)

        assert dp.to_str() == expected
예제 #5
0
 def _to_row_item(self, row_idx: int, col_dp: ColumnDataProperty,
                  value_dp: DataProperty) -> str:
     return value_dp.to_str()
예제 #6
0
    def test_normal_format_str(self, value, format_flags, expected):
        dp = DataProperty(value, format_flags=format_flags)

        assert dp.to_str() == expected