mdmodels-core 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/publish_pypi.yml +1 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/publish_test_pypi.yml +14 -2
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/Cargo.lock +11 -11
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/Cargo.toml +2 -2
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/PKG-INFO +2 -2
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/pyproject.toml +1 -1
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/attribute.rs +178 -1
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/scripts/generate_types.sh +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/assets.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/docs.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/format.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/lint.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/npm_bundler.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/npm_web.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/publish.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.github/workflows/test.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/.gitignore +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/LICENSE.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/README.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/assets/schema.png +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/build.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/index.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/library/code-generation.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/library/conversion.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/library/index.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/library/pipelines.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/library/validation.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/syntax.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/types/equation.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/types/index.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/docs/types/unit-definition.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/mkdocs.yml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/bin/cli.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/bindings/python.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/bindings/wasm.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/datamodel.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/exporters.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/json/datatype.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/json/parser.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/lib.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/markdown/frontmatter.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/markdown/parser.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/object.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/pipeline.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/primitives.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/schema.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/validation.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/src/xmltype.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/markdown-compact.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/markdown.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/mkdocs.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/python-dataclass.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/python-macros.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/python-pydantic-xml.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/python-pydantic.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/shacl.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/shex.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/typescript.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/templates/xml-schema.jinja +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_json_schema.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_mkdocs.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_pydantic.py +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_python_dc.py +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_python_pydantic_xml.py +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_sdrdm_full_schema.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_sdrdm_schema.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_sdrdm_schema_inheritance.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_shacl.ttl +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_shex.shex +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_typescript.ts +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_xml_schema.xsd +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_duplicates.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_full_documentation.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_inheritance.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_inheritance_invalid.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_invalid_names.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_merge.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_merge_invalid.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_missing_types.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_multiple_keyword.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_no_frontmatter.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_no_objects.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/model_w_html.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/integration_tests.rs +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/test_pipeline.toml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/test_pipeline_per_spec.toml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/test_pipeline_per_spec_invalid.toml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/README.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/equation/equation-internal.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/equation/equation.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/equation/equation.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/equation/equation.xsd +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/equation/gen.toml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/gen.toml +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/unit-definition-internal.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/unit-definition.json +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/unit-definition.md +0 -0
- {mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/unit-definition.xsd +0 -0
|
@@ -29,8 +29,6 @@ jobs:
|
|
|
29
29
|
target: aarch64
|
|
30
30
|
- runner: ubuntu-latest
|
|
31
31
|
target: armv7
|
|
32
|
-
- runner: ubuntu-latest
|
|
33
|
-
target: s390x
|
|
34
32
|
- runner: ubuntu-latest
|
|
35
33
|
target: ppc64le
|
|
36
34
|
steps:
|
|
@@ -45,6 +43,20 @@ jobs:
|
|
|
45
43
|
args: --release --out dist --find-interpreter --features python
|
|
46
44
|
sccache: "true"
|
|
47
45
|
manylinux: auto
|
|
46
|
+
before-script-linux: |
|
|
47
|
+
# If we're running on rhel centos, install needed packages.
|
|
48
|
+
if command -v yum &> /dev/null; then
|
|
49
|
+
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
|
|
50
|
+
|
|
51
|
+
# If we're running on i686 we need to symlink libatomic
|
|
52
|
+
# in order to build openssl with -latomic flag.
|
|
53
|
+
if [[ ! -d "/usr/lib64" ]]; then
|
|
54
|
+
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
|
|
55
|
+
fi
|
|
56
|
+
else
|
|
57
|
+
# If we're running on debian-based system.
|
|
58
|
+
apt update -y && apt-get install -y libssl-dev openssl pkg-config
|
|
59
|
+
fi
|
|
48
60
|
- name: Upload wheels
|
|
49
61
|
uses: actions/upload-artifact@v4
|
|
50
62
|
with:
|
|
@@ -781,7 +781,7 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
|
|
781
781
|
|
|
782
782
|
[[package]]
|
|
783
783
|
name = "mdmodels"
|
|
784
|
-
version = "0.1.
|
|
784
|
+
version = "0.1.4"
|
|
785
785
|
dependencies = [
|
|
786
786
|
"assert_cmd",
|
|
787
787
|
"clap",
|
|
@@ -1101,9 +1101,9 @@ dependencies = [
|
|
|
1101
1101
|
|
|
1102
1102
|
[[package]]
|
|
1103
1103
|
name = "pyo3"
|
|
1104
|
-
version = "0.
|
|
1104
|
+
version = "0.23.2"
|
|
1105
1105
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1106
|
-
checksum = "
|
|
1106
|
+
checksum = "f54b3d09cbdd1f8c20650b28e7b09e338881482f4aa908a5f61a00c98fba2690"
|
|
1107
1107
|
dependencies = [
|
|
1108
1108
|
"cfg-if",
|
|
1109
1109
|
"indoc",
|
|
@@ -1119,9 +1119,9 @@ dependencies = [
|
|
|
1119
1119
|
|
|
1120
1120
|
[[package]]
|
|
1121
1121
|
name = "pyo3-build-config"
|
|
1122
|
-
version = "0.
|
|
1122
|
+
version = "0.23.2"
|
|
1123
1123
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1124
|
-
checksum = "
|
|
1124
|
+
checksum = "3015cf985888fe66cfb63ce0e321c603706cd541b7aec7ddd35c281390af45d8"
|
|
1125
1125
|
dependencies = [
|
|
1126
1126
|
"once_cell",
|
|
1127
1127
|
"target-lexicon",
|
|
@@ -1129,9 +1129,9 @@ dependencies = [
|
|
|
1129
1129
|
|
|
1130
1130
|
[[package]]
|
|
1131
1131
|
name = "pyo3-ffi"
|
|
1132
|
-
version = "0.
|
|
1132
|
+
version = "0.23.2"
|
|
1133
1133
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1134
|
-
checksum = "
|
|
1134
|
+
checksum = "6fca7cd8fd809b5ac4eefb89c1f98f7a7651d3739dfb341ca6980090f554c270"
|
|
1135
1135
|
dependencies = [
|
|
1136
1136
|
"libc",
|
|
1137
1137
|
"pyo3-build-config",
|
|
@@ -1139,9 +1139,9 @@ dependencies = [
|
|
|
1139
1139
|
|
|
1140
1140
|
[[package]]
|
|
1141
1141
|
name = "pyo3-macros"
|
|
1142
|
-
version = "0.
|
|
1142
|
+
version = "0.23.2"
|
|
1143
1143
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1144
|
-
checksum = "
|
|
1144
|
+
checksum = "34e657fa5379a79151b6ff5328d9216a84f55dc93b17b08e7c3609a969b73aa0"
|
|
1145
1145
|
dependencies = [
|
|
1146
1146
|
"proc-macro2",
|
|
1147
1147
|
"pyo3-macros-backend",
|
|
@@ -1151,9 +1151,9 @@ dependencies = [
|
|
|
1151
1151
|
|
|
1152
1152
|
[[package]]
|
|
1153
1153
|
name = "pyo3-macros-backend"
|
|
1154
|
-
version = "0.
|
|
1154
|
+
version = "0.23.2"
|
|
1155
1155
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1156
|
-
checksum = "
|
|
1156
|
+
checksum = "295548d5ffd95fd1981d2d3cf4458831b21d60af046b729b6fd143b0ba7aee2f"
|
|
1157
1157
|
dependencies = [
|
|
1158
1158
|
"heck",
|
|
1159
1159
|
"proc-macro2",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name = "mdmodels"
|
|
3
3
|
authors = ["Jan Range <jan.range@simtech.uni-stuttgart.de>"]
|
|
4
4
|
description = "A tool to generate models, code and schemas from markdown files"
|
|
5
|
-
version = "0.1.
|
|
5
|
+
version = "0.1.4"
|
|
6
6
|
edition = "2021"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
repository = "https://github.com/FAIRChemistry/md-models"
|
|
@@ -28,7 +28,7 @@ colored = "2.1.0"
|
|
|
28
28
|
convert_case = "0.6.0"
|
|
29
29
|
toml = "0.8.14"
|
|
30
30
|
textwrap = "0.16.1"
|
|
31
|
-
pyo3 = { version = "0.
|
|
31
|
+
pyo3 = { version = "0.23.2", features = ["extension-module"], optional = true }
|
|
32
32
|
wasm-bindgen = { version = "0.2.95", optional = true }
|
|
33
33
|
serde-wasm-bindgen = { version = "0.6.5", optional = true }
|
|
34
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: mdmodels_core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -26,7 +26,7 @@ use serde::{de::Visitor, Deserialize, Serialize};
|
|
|
26
26
|
use std::{error::Error, fmt, str::FromStr};
|
|
27
27
|
|
|
28
28
|
#[cfg(feature = "python")]
|
|
29
|
-
use pyo3::pyclass;
|
|
29
|
+
use pyo3::{pyclass, pymethods};
|
|
30
30
|
|
|
31
31
|
/// Represents an attribute with various properties and options.
|
|
32
32
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
|
@@ -210,6 +210,57 @@ pub enum DataType {
|
|
|
210
210
|
String(String),
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
#[cfg_attr(feature = "python", pymethods)]
|
|
214
|
+
impl DataType {
|
|
215
|
+
pub fn is_boolean(&self) -> bool {
|
|
216
|
+
matches!(self, DataType::Boolean(_))
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
pub fn is_integer(&self) -> bool {
|
|
220
|
+
matches!(self, DataType::Integer(_))
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
pub fn is_float(&self) -> bool {
|
|
224
|
+
matches!(self, DataType::Float(_))
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
pub fn is_string(&self) -> bool {
|
|
228
|
+
matches!(self, DataType::String(_))
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
pub fn as_boolean(&self) -> Option<bool> {
|
|
232
|
+
if let DataType::Boolean(value) = self {
|
|
233
|
+
Some(*value)
|
|
234
|
+
} else {
|
|
235
|
+
None
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
pub fn as_integer(&self) -> Option<i64> {
|
|
240
|
+
if let DataType::Integer(value) = self {
|
|
241
|
+
Some(*value)
|
|
242
|
+
} else {
|
|
243
|
+
None
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
pub fn as_float(&self) -> Option<f64> {
|
|
248
|
+
if let DataType::Float(value) = self {
|
|
249
|
+
Some(*value)
|
|
250
|
+
} else {
|
|
251
|
+
None
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
pub fn as_string(&self) -> Option<String> {
|
|
256
|
+
if let DataType::String(value) = self {
|
|
257
|
+
Some(value.clone())
|
|
258
|
+
} else {
|
|
259
|
+
None
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
213
264
|
impl PartialEq for DataType {
|
|
214
265
|
fn eq(&self, other: &Self) -> bool {
|
|
215
266
|
match (self, other) {
|
|
@@ -460,4 +511,130 @@ mod tests {
|
|
|
460
511
|
serde_json::from_str("true").expect("Failed to deserialize bool DataType");
|
|
461
512
|
assert_eq!(deserialized, DataType::Boolean(true));
|
|
462
513
|
}
|
|
514
|
+
|
|
515
|
+
#[test]
|
|
516
|
+
fn is_boolean_returns_true_for_boolean() {
|
|
517
|
+
let dt = DataType::Boolean(true);
|
|
518
|
+
assert!(dt.is_boolean());
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
#[test]
|
|
522
|
+
fn is_boolean_returns_false_for_non_boolean() {
|
|
523
|
+
let dt = DataType::Integer(1);
|
|
524
|
+
assert!(!dt.is_boolean());
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
#[test]
|
|
528
|
+
fn is_integer_returns_true_for_integer() {
|
|
529
|
+
let dt = DataType::Integer(1);
|
|
530
|
+
assert!(dt.is_integer());
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
#[test]
|
|
534
|
+
fn is_integer_returns_false_for_non_integer() {
|
|
535
|
+
let dt = DataType::Boolean(true);
|
|
536
|
+
assert!(!dt.is_integer());
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
#[test]
|
|
540
|
+
fn is_float_returns_true_for_float() {
|
|
541
|
+
let dt = DataType::Float(1.0);
|
|
542
|
+
assert!(dt.is_float());
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
#[test]
|
|
546
|
+
fn is_float_returns_false_for_non_float() {
|
|
547
|
+
let dt = DataType::String("string".to_string());
|
|
548
|
+
assert!(!dt.is_float());
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
#[test]
|
|
552
|
+
fn is_string_returns_true_for_string() {
|
|
553
|
+
let dt = DataType::String("string".to_string());
|
|
554
|
+
assert!(dt.is_string());
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
#[test]
|
|
558
|
+
fn is_string_returns_false_for_non_string() {
|
|
559
|
+
let dt = DataType::Float(1.0);
|
|
560
|
+
assert!(!dt.is_string());
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
#[test]
|
|
564
|
+
fn as_boolean_returns_some_for_boolean() {
|
|
565
|
+
let dt = DataType::Boolean(true);
|
|
566
|
+
assert_eq!(dt.as_boolean(), Some(true));
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
#[test]
|
|
570
|
+
fn as_boolean_returns_none_for_non_boolean() {
|
|
571
|
+
let dt = DataType::Integer(1);
|
|
572
|
+
assert_eq!(dt.as_boolean(), None);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
#[test]
|
|
576
|
+
fn as_integer_returns_some_for_integer() {
|
|
577
|
+
let dt = DataType::Integer(1);
|
|
578
|
+
assert_eq!(dt.as_integer(), Some(1));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
#[test]
|
|
582
|
+
fn as_integer_returns_none_for_non_integer() {
|
|
583
|
+
let dt = DataType::Boolean(true);
|
|
584
|
+
assert_eq!(dt.as_integer(), None);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
#[test]
|
|
588
|
+
fn as_float_returns_some_for_float() {
|
|
589
|
+
let dt = DataType::Float(1.0);
|
|
590
|
+
assert_eq!(dt.as_float(), Some(1.0));
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
#[test]
|
|
594
|
+
fn as_float_returns_none_for_non_float() {
|
|
595
|
+
let dt = DataType::String("string".to_string());
|
|
596
|
+
assert_eq!(dt.as_float(), None);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
#[test]
|
|
600
|
+
fn as_string_returns_some_for_string() {
|
|
601
|
+
let dt = DataType::String("string".to_string());
|
|
602
|
+
assert_eq!(dt.as_string(), Some("string".to_string()));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
#[test]
|
|
606
|
+
fn as_string_returns_none_for_non_string() {
|
|
607
|
+
let dt = DataType::Float(1.0);
|
|
608
|
+
assert_eq!(dt.as_string(), None);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
#[test]
|
|
612
|
+
fn from_str_parses_boolean() {
|
|
613
|
+
let dt = DataType::from_str("true").unwrap();
|
|
614
|
+
assert_eq!(dt, DataType::Boolean(true));
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
#[test]
|
|
618
|
+
fn from_str_parses_integer() {
|
|
619
|
+
let dt = DataType::from_str("42").unwrap();
|
|
620
|
+
assert_eq!(dt, DataType::Integer(42));
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
#[test]
|
|
624
|
+
fn from_str_parses_float() {
|
|
625
|
+
let dt = DataType::from_str("3.5").unwrap();
|
|
626
|
+
assert_eq!(dt, DataType::Float(3.5));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
#[test]
|
|
630
|
+
fn from_str_parses_string() {
|
|
631
|
+
let dt = DataType::from_str("hello").unwrap();
|
|
632
|
+
assert_eq!(dt, DataType::String("\"hello\"".to_string()));
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
#[test]
|
|
636
|
+
fn from_str_returns_error_for_invalid_data_type() {
|
|
637
|
+
let dt = DataType::from_str("");
|
|
638
|
+
assert!(dt.is_err());
|
|
639
|
+
}
|
|
463
640
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/tests/data/expected_sdrdm_schema_inheritance.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mdmodels_core-0.1.3 → mdmodels_core-0.1.4}/types/unit-definition/unit-definition-internal.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|