Skip to content

Commit dfba1a9

Browse files
committed
Add tests
1 parent 3eaf7f1 commit dfba1a9

File tree

2 files changed

+442
-0
lines changed

2 files changed

+442
-0
lines changed

tests/test_quick_tests.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,23 @@ def test_random_generation_without_range_values(self, columnSpecOptions):
751751
sortedVals = sortedDf.select("randCol").collect()
752752
assert sortedVals != df.select("randCol").collect()
753753

754+
def test_to_dict(self):
755+
gen = dg.DataGenerator(name="test", rows=100, partitions=1)
756+
d = gen.toDict()
757+
assert d["name"] == "test"
758+
assert d["rows"] == 100
759+
assert d["partitions"] == 1
760+
761+
def test_from_dict(self):
762+
gen = dg.DataGenerator(name="test", rows=1000, partitions=2)
763+
d = gen.toDict()
764+
d["type"] = "DataGenerator"
765+
new_gen = DataGenerator.fromDict(d)
766+
assert new_gen.name == "test"
767+
assert new_gen.rowCount == 1000
768+
assert new_gen.partitions == 2
769+
770+
754771
def test_version_info(self):
755772
# test access to version info without explicit import
756773
print("Data generator version", dg.__version__)

0 commit comments

Comments
 (0)